/***************************************************************************** # Copyright (C) 1994-2008 by David Gordon. # All rights reserved. # # This software is part of a beta-test version of the Consed/Autofinish # package. It should not be redistributed or # used for any commercial purpose, including commercially funded # sequencing, without written permission from the author and the # University of Washington. # # This software is provided ``AS IS'' and any express or implied # warranties, including, but not limited to, the implied warranties of # merchantability and fitness for a particular purpose, are disclaimed. # In no event shall the authors or the University of Washington be # liable for any direct, indirect, incidental, special, exemplary, or # consequential damages (including, but not limited to, procurement of # substitute goods or services; loss of use, data, or profits; or # business interruption) however caused and on any theory of liability, # whether in contract, strict liability, or tort (including negligence # or otherwise) arising in any way out of the use of this software, even # if advised of the possibility of such damage. # # Building Consed from source is error prone and not simple which is # why I provide executables. Due to time limitations I cannot # provide any assistance in building Consed. Even if you do not # modify the source, you may introduce errors due to using a # different version of the compiler, a different version of motif, # different versions of other libraries than I used, etc. For this # reason, if you discover Consed bugs, I can only offer help with # those bugs if you first reproduce those bugs with an executable # provided by me--not an executable you have built. # # Modifying Consed is also difficult. Although Consed is modular, # some modules are used by many other modules. Thus making a change # in one place can have unforeseen effects on many other features. # It may takes months for you to notice these other side-effects # which may not seen connected at all. It is not feasable for me to # provide help with modifying Consed sources because of the # potentially huge amount of time involved. # #*****************************************************************************/ #ifndef experiment_included #define experiment_included #include using namespace std; #include #include #include "rwtvalorderedvector.h" #include "readTypes.h" #include "primerType.h" #include "sysdepend.h" #include "autoFinishPurposes.h" #include "contigEnd.h" class LocatedFragment; class subcloneTTemplate; class autoFinishExpTag; const int nAvailableExperiment = 0; const int nChosenExperiment = 1; const int nRejectedExperiment = 2; class experiment { public: double dErrorsFixedPerDollar_; double dErrorsFixedJustInConsensusPerDollar_; double dErrorsFixed_; // This counts bases that are off the consensus as errors fixed. double dErrorsFixedJustInConsensus_; // This is only set when an experiment is accepted. readTypes ucStrandAndChemistry_; // see readTypes.h TOP_STRAND_TERMINATOR_READS or // BOTTOM_STRAND_TERMINATOR_READS int nReadType_; // see readTypes.h // nUniversalForward, nUniversalReverse, nWalk bool bCloneTemplateNotSubcloneTemplate_; float fCost_; primerType* pCustomPrimer_; Contig* pContig_; subcloneTTemplate* pSubcloneTemplate_; // this is not used in the case of custom primer reads--just // universal primer reads and reverses int nFirstBaseOfReadUnpadded_; // this occurs after the 3' end of the primer, for custom // primer experiments // these give the expected location of the read. If the read // is a universal primer read, then: // xxxxxxBBBBBBBBBBBBBBBBB... // ^ // nUnpaddedLeft_ // and similarly for bottom strand reads and nUnpaddedRight_ int nUnpaddedLeft_; int nUnpaddedRight_; bool bTopStrandNotBottomStrand_; // this refers to the strand of the suggested read (true even in // the case of flank gap experiments) int nState_; // available, chosen, or rejected int nExtendsIntoWhichGap_; // left, right, or none--see contigEnd.h int nPriorityRanking_; // -1 if nState_ is not nAvailable int nSingleSubcloneBasesFixed_; double dSingleSubcloneBasesFixedPerDollar_; // bool bReverseForFlankingGap_; RWTValOrderedVector aExpID_; // only for chosen experiments // one experiment id for each template int nPrimerID_; // only for chosen experiments that have // custom primers int nPurpose_; // only for chosen experiments, // see autoFinishPurposes.h bool bDeNovoUniversalPrimerRead_; // this is not resequencing--it // is calling a universal primer estimating its location based on its // mate's location int nWindowOfMostErrorsFixedUnpaddedRight_; double dErrorsFixedInWindow_; int nWindowOfMostSingleSubcloneBasesFixedUnpaddedRight_; int nSingleSubcloneBasesFixedInWindow_; bool bCrossesRun_; bool bCrossesStop_; public: experiment() : bDeNovoUniversalPrimerRead_( false ), nSingleSubcloneBasesFixed_(0), nSingleSubcloneBasesFixedInWindow_( 0 ), nWindowOfMostSingleSubcloneBasesFixedUnpaddedRight_(-666 ), bCrossesRun_( false ), bCrossesStop_( false ), dErrorsFixed_( -1 ), dErrorsFixedPerDollar_( -1 ), dErrorsFixedJustInConsensusPerDollar_( -1 ), dErrorsFixedJustInConsensus_( -1 ), pContig_( NULL ), nUnpaddedLeft_( -1 ), nUnpaddedRight_( -1 ), dErrorsFixedInWindow_( -1 ), nWindowOfMostErrorsFixedUnpaddedRight_( -1 ), nExtendsIntoWhichGap_( nNoGap ) {} bool operator==( const experiment& exp ) const { return( ( exp.dErrorsFixed_ == dErrorsFixed_ ) && ( exp.nState_ == nState_ ) ); } // this is constructed so that a sort will put the // unchosen ones with most errors at the beginning of the list // (qsort sorts in ascending order) bool operator<( const experiment& exp ) const { if ( (nState_ != nAvailableExperiment) && ( exp.nState_ == nAvailableExperiment ) ) return false; else if ( ( nState_ == nAvailableExperiment) && ( exp.nState_ != nAvailableExperiment ) ) return true; else return( dErrorsFixedPerDollar_ > exp.dErrorsFixedPerDollar_ ); } bool bOverlaps( experiment* pExperiment ); // can be for extending into gaps, fixing low consensus quality // regions, or covering single subclone regions, or for flanking gaps void print(); void setGotoItemDescription( char* szDescription ); void writeAutoFinishExpTagToAceFile( ofstream& ofsAceFile ); void setPrimerIDIfNecessary(); void chooseExperiment(); bool bHasThisExperimentOrOneLikeItBeenTriedBefore(); bool bHasCloseCustomPrimerExperimentBeenTriedBefore(); bool bHasUniversalPrimerExperimentBeenTriedBefore( const bool bForwardNotReverseUniversalPrimer ); // bool bHasReverseUniversalPrimerExperimentBeenTriedBefore(); void printRejectExperiment( autoFinishExpTag* pAutoFinishExp ); void printRejectResequencingUniversalPrimerAutofinishExperiment( LocatedFragment* pLocFrag ); void printToSummaryFile( FILE* pFile ); void printToSummaryFile2( FILE* pFile ); void printToCustomNavigationFile( FILE* pFile ); bool bIsPointingIn( const int nExtendsIntoWhichGap ); inline bool bIsUniversalPrimerRead() { if ( ( nReadType_ == nUniversalForward ) || ( nReadType_ == nUniversalReverse ) ) return( true ); else return( false ); } inline bool bIsCustomPrimerSubcloneRead() { if ( !bIsUniversalPrimerRead() && !bCloneTemplateNotSubcloneTemplate_ ) return( true ); else return( false ); } inline bool bIsWholeCloneRead() { if ( !bIsUniversalPrimerRead() && bCloneTemplateNotSubcloneTemplate_ ) return( true ); else return( false ); } inline bool bIsResequencingRead() { if ( bIsUniversalPrimerRead() && !bDeNovoUniversalPrimerRead_ ) return( true ); else return( false ); } }; #endif