/** ** Copyright (c) 2003-2006 Solexa Limited. All rights reserved. ** Copyright (c) 2007-2010 Illumina, Inc. ** ** This software is covered by the "Illumina Genome Analyzer Software ** License Agreement" and the "Illumina Source Code License Agreement", ** and certain third party copyright/licenses, and any user of this ** source file is bound by the terms therein (see accompanying files ** Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ** Illumina_Source_Code_License_Agreement.pdf and third party ** copyright/license notices). ** ** This file is part of the Consensus Assessment of Sequence And VAriation ** (CASAVA) software package. ** ** \file eland_ms/ElandConstants.hh ** ** \brief Part of ELAND ** ** Part of ELAND ** Contains interface functionality from ELAND - specifically, stuff to do ** with scoring and storage of alignments ** ** \author Tony Cox **/ #ifndef CASAVA_ELAND_MS_ELAND_CONSTANTS_H #define CASAVA_ELAND_MS_ELAND_CONSTANTS_H #include #include #include "alignment/GlobalUtilities.hh" #include "ElandDefines.hh" namespace casava { namespace eland_ms { // Program-wide compile-time constants template class ElandConstants { public: enum{ // hashShift is the number of bits to shift for a given OLIGO_LEN // so that the number of bases stored in each of the two unsigned ints // is either equal (if OLIGO_LEN is even) or else (if OLIGO_LEN is // odd) differs only by 1. // hashShift = ((2*numBitsPerWord/numBitsPerBase)-OLIGO_LEN+1)&(~1), // an oligo is divided into four fragments fragmentsPerOligo = 4, // basesPerFragment = (OLIGO_LEN/fragmentsPerOligo), // bitsPerFragment = 2*basesPerFragment, // oligo is partitioned into a prefix and suffix, each containing two // fragments fragmentsPerPartition = 2, // there are 6 ways of partitioning the 4 fragments into a prefix and // a suffix (not 24 as we are not concerned about the ordering of the // fragments within the prefix and suffix). Two of these partitionings are // searched on each pass through the genome, hence 3 passes required in all numPasses = 3, // if more than this many matches of a given quality have already been found // for an oligo then don't look for any more, e.g. if we have more than 3 // matches with 2 errors, then only single error or exact match errors // will be looked for on subsequent passes maxNumBestMatches = 3, // length (in bits) of largest suffix that will be needed for this oligo length // length 20 => fragments = 5 5 5 5 => largest suffix =5+5=10 bases = 20 bits // length 21 => fragments = 5 6 5 5 => largest suffix =5+6=11 bases = 22 bits // length 22 => fragments = 5 6 5 6 => largest suffix =6+6=12 bases = 24 bits // length 23 => fragments = 6 5 6 6 => largest suffix =6+6=12 bases = 24 bits // length 24 => fragments = 6 6 6 6 => largest suffix =6+6=12 bases = 24 bits maxPrefixLength = OLIGO_LEN +((OLIGO_LEN%fragmentsPerOligo)!=0) +((OLIGO_LEN%fragmentsPerOligo)==2), maxOligoLength = 2*maxBasesPerWord, // Oligos are split into fragments as follows: // Oligo Length Fragment Lengths: A B C D // 20 5 5 5 5 // 21 5 6 5 5 // 22 5 6 5 6 // 23 6 5 6 6 // 24 6 6 6 6 // 25 6 7 6 6 ... etc. fragLengthA=((OLIGO_LEN/fragmentsPerOligo) + ((OLIGO_LEN%fragmentsPerOligo)==3)), fragLengthB=((OLIGO_LEN/fragmentsPerOligo) + ( ((OLIGO_LEN%fragmentsPerOligo)==1) ||((OLIGO_LEN%fragmentsPerOligo)==2))), fragLengthC=((OLIGO_LEN/fragmentsPerOligo) + ((OLIGO_LEN%fragmentsPerOligo)==3)), fragLengthD=((OLIGO_LEN/fragmentsPerOligo) + ( ((OLIGO_LEN%fragmentsPerOligo)==2) ||((OLIGO_LEN%fragmentsPerOligo)==3))), prefixLength=fragLengthC+fragLengthD, suffixLength=fragLengthA+fragLengthB }; BOOST_STATIC_ASSERT(OLIGO_LEN<=maxOligoLength); // Software operates in two modes: // 1. Standard mode, each oligo is split into prefix and suffix, prefix used to // make a look up table // 2. "Split prefix" mode: prefix is too large to be used to make a look up table // so "hide" some bits in the TableEntry static const bool useSplitPrefix = (maxPrefixLength>MAX_HASH_BITS); //const int maxNumOligos((1<<(MAX_HASH_BITS-1))-1); // next two should be OligoNumbers really? static const Word splitPrefixMaskHigh = ( ((Word)~0) << MAX_HASH_BITS ); static const Word splitPrefixMaskLow = (~splitPrefixMaskHigh); static const Word prefixMask = (((uint)prefixLength==(uint)maxBasesPerWord) ? 0 : (((Word)~0)<< boost::static_signed_min::value) ); static const Word suffixMask = (((uint)suffixLength==(uint)maxBasesPerWord) ? 0 : (((Word)~0)<< boost::static_signed_min::value) ); }; static const unsigned int maxOligoNum = 67108864; typedef ushort FragmentErrorType; #ifdef OLD_FRAGMENT_ERROR_DEFS const int errorBits(6); const FragmentErrorType incrementDist ( ((FragmentErrorType)1) << (2*errorBits) ); const FragmentErrorType errorMask1( (((FragmentErrorType)1)<>(8 * sizeof(MatchPosition) - blockShift)); const MatchPosition blockRepeat(((MatchPosition)0xF0)<