/***************************************************************************** # 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. # #*****************************************************************************/ #include #include #include "consedParameters.h" #include "consedResources.h" #include #include "nPrimerFalseMatchScoreArray.h" #include "rwctokenizer.h" #include "tagTypes.h" #include "mbt_exception.h" #include "bIsNumericMaybeWithWhitespace.h" #include "guiFindRestrictionEnzymeSites.h" #define DEFINE_SOLINE #include "soLine.h" #include "rwcregexp.h" // // static class members // consedParameters* consedParameters::pGlobalConsedParameters_ = 0; // pointer to sole instance bool consedParameters::bConsedParametersCreated_ = false; // flag indicates instance exists RWCString consedParameters :: soGetDocumentation() { if ( soDocumentation_.isNull() ) setDocumentation(); return( soDocumentation_ ); } void consedParameters :: setParametersForSequencingPrimersNotPCRPrimers( const bool bSequencingNotPCR ) { if ( bSequencingNotPCR ) { nPrimersMinimumLengthOfAPrimerToUse_ = nPrimersMinimumLengthOfAPrimer_; nPrimersMaximumLengthOfAPrimerToUse_ = nPrimersMaximumLengthOfAPrimer_; nPrimersMinMeltingTempToUse_ = nPrimersMinMeltingTemp_; nPrimersMaxMeltingTempToUse_ = nPrimersMaxMeltingTemp_; nPrimersWindowSizeInLookingToUse_ = nPrimersWindowSizeInLooking_; nPrimersMaxMatchElsewhereScoreToUse_ = nPrimersMaxMatchElsewhereScore_; } else { nPrimersMinimumLengthOfAPrimerToUse_ = nPrimersMinimumLengthOfAPrimerForPCR_; nPrimersMaximumLengthOfAPrimerToUse_ = nPrimersMaximumLengthOfAPrimerForPCR_; nPrimersMinMeltingTempToUse_ = nPrimersMinMeltingTempForPCR_; nPrimersMaxMeltingTempToUse_ = nPrimersMaxMeltingTempForPCR_; nPrimersWindowSizeInLookingToUse_ = nPrimersWindowSizeInLookingForPCR_; nPrimersMaxMatchElsewhereScoreToUse_ = nPrimersMaxMatchElsewhereScoreForPCR_; } } consedParameters :: consedParameters() { // just zero-out the entire space memset( this, 0, sizeof( consedParameters ) ); } void consedParameters :: copyPrimerPickingParametersToSelf( consedParameters* pCPSource ) { // I wouldn't be surprised if I missed some... nPrimersMinimumLengthOfAPrimerToUse_ = pCPSource->nPrimersMinimumLengthOfAPrimerToUse_; nPrimersMaximumLengthOfAPrimerToUse_ = pCPSource->nPrimersMaximumLengthOfAPrimerToUse_; nPrimersMinMeltingTempToUse_ = pCPSource->nPrimersMinMeltingTempToUse_; nPrimersMaxMeltingTempToUse_ = pCPSource->nPrimersMaxMeltingTempToUse_; nPrimersWindowSizeInLookingToUse_ = pCPSource->nPrimersWindowSizeInLookingToUse_; nPrimersMaxMatchElsewhereScoreToUse_ = pCPSource->nPrimersMaxMatchElsewhereScoreToUse_; nPrimersMinMeltingTempForPCR_ = pCPSource->nPrimersMinMeltingTempForPCR_; nPrimersMaxMeltingTempForPCR_ = pCPSource->nPrimersMaxMeltingTempForPCR_; nPrimersMinMeltingTemp_ = pCPSource->nPrimersMinMeltingTemp_; nPrimersMaxMeltingTemp_ = pCPSource->nPrimersMaxMeltingTemp_; nPrimersWindowSizeInLooking_ = pCPSource->nPrimersWindowSizeInLooking_; nPrimersALittleLessThanAverageInsertSizeOfASubcloneToUse_ = pCPSource->nPrimersALittleLessThanAverageInsertSizeOfASubcloneToUse_; nPrimersTooManyVectorBasesInWalkingRead_ = pCPSource->nPrimersTooManyVectorBasesInWalkingRead_; nPrimersToleranceForDifferentBeginningLocationOfUniversalPrimerReads_ = pCPSource->nPrimersToleranceForDifferentBeginningLocationOfUniversalPrimerReads_; bPrimersScreenForVector_ = pCPSource->bPrimersScreenForVector_; dPrimersSaltConcentrationMillimolar_ = pCPSource->dPrimersSaltConcentrationMillimolar_; bPrimersPrintInfoOnRejectedTemplates_ = pCPSource->bPrimersPrintInfoOnRejectedTemplates_; nPrimersMinQuality_ = pCPSource->nPrimersMinQuality_; nPrimersMaxPrimerDimerScoreForPCR_ = pCPSource->nPrimersMaxPrimerDimerScoreForPCR_; nPrimersMaxSelfMatchScore_ = pCPSource->nPrimersMaxSelfMatchScore_; nPrimersMaxMatchElsewhereScoreForPCR_ = pCPSource->nPrimersMaxMatchElsewhereScoreForPCR_; nPrimersMaxMatchElsewhereScore_ = pCPSource->nPrimersMaxMatchElsewhereScore_; dPrimersDNAConcentrationNanomolar_ = pCPSource->dPrimersDNAConcentrationNanomolar_; nPrimersLookThisFarForForwardVectorInsertJunction_ = pCPSource->nPrimersLookThisFarForForwardVectorInsertJunction_; nPrimersLookForThisManyPCRPrimerPairsPerPairOfGroups_ = pCPSource->nPrimersLookForThisManyPCRPrimerPairsPerPairOfGroups_; nPrimersPCRPrimersGroupedIntoWindowOfThisManyBases_ = pCPSource->nPrimersPCRPrimersGroupedIntoWindowOfThisManyBases_; nPrimersWindowSizeInLookingForPCR_ = pCPSource->nPrimersWindowSizeInLookingForPCR_; nPrimersWhenChoosingATemplateMinPotentialReadLength_ = pCPSource->nPrimersWhenChoosingATemplateMinPotentialReadLength_; bPrimersChooseTemplatesByPositionInsteadOfQuality_ = pCPSource->bPrimersChooseTemplatesByPositionInsteadOfQuality_; filPrimersBadTemplatesFile_ = pCPSource->filPrimersBadTemplatesFile_; filPrimersLibrariesInfoFile_ = pCPSource->filPrimersLibrariesInfoFile_; filPrimersBadLibrariesFile_ = pCPSource->filPrimersBadLibrariesFile_; nPrimersMaxLengthOfMononucleotideRepeat_ = pCPSource->nPrimersMaxLengthOfMononucleotideRepeat_; nPrimersNumberOfTemplatesToDisplayInFront_ = pCPSource->nPrimersNumberOfTemplatesToDisplayInFront_; bPrimersCheckJustSomePCRPrimerPairsRatherThanAll_ = pCPSource->bPrimersCheckJustSomePCRPrimerPairsRatherThanAll_; nPrimersMaxPCRPrimerPairsToDisplay_ = pCPSource->nPrimersMaxPCRPrimerPairsToDisplay_; dPrimersMaxMeltingTempDifferenceForPCR_ = pCPSource->dPrimersMaxMeltingTempDifferenceForPCR_; nPrimersMaximumLengthOfAPrimerForPCR_ = pCPSource->nPrimersMaximumLengthOfAPrimerForPCR_; nPrimersMinimumLengthOfAPrimerForPCR_ = pCPSource->nPrimersMinimumLengthOfAPrimerForPCR_; nPrimersMaximumLengthOfAPrimer_ = pCPSource->nPrimersMaximumLengthOfAPrimer_; nPrimersMinimumLengthOfAPrimer_ = pCPSource->nPrimersMinimumLengthOfAPrimer_; nPrimersMinNumberOfTemplatesForPrimers_ = pCPSource->nPrimersMinNumberOfTemplatesForPrimers_; bPrimersOKToChoosePrimersInSingleSubcloneRegion_ = pCPSource->bPrimersOKToChoosePrimersInSingleSubcloneRegion_; bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_ = pCPSource->bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_; bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_ = pCPSource->bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_; } consedParameters::consedParameters( consedResources* pRes ) : bWarnUserAboutOverstrikingWithUppercase_( true ), bErrorMessageDisplayedAtStartup_( false ), nAutoFinishLastUsedPrimerNumber_( 0 ), bOKToUseGui_( true ), nAutoFinishNumberOfCloningSitesFound_( 0 ), nLastUsedExpID_( 0 ), nWhatIsRunning_( 0 ), bReadyToPickSecondPCRPrimer_( false ), pDefaultLibrary_( NULL ), bReadOnly_( false ), pAutoFinishFullOutput_( stdout ), bNeedToSetContigTemplateArrays_( true ), cFindRestrictionEnzymeSitesLastUsedWholeCloneOrPartOfCloneOrWholeContig_( guiFindRestrictionEnzymeSites::cWHOLE_CLONE ), soFindRestrictionEnzymeSitesLastUsedUserEnteredContigMap_( soEmptyString ), nFindRestrictionEnzymeSitesLastUsedStartUnpaddedConsPos_( -666 ), nFindRestrictionEnzymeSitesLastUsedEndUnpaddedConsPos_( -666 ), soFindRestrictionEnzymeSitesLastUsedContigAbbreviatedName_( soEmptyString ), bWarnUserAboutAmbiguityCodes_( true ), bAllowTimestampMismatch_( false ), bPrintInFigureOutContigOrderAndOrientation_( true ), bLimitNumberOfErrorsReported_( false ), nNumberOfStartupErrors_( 0 ) { // // fail crudely if one already exists - we may not have // a gui at all yet // if (bConsedParametersCreated_) { cerr << "Fatal program error: consedParameters ctor called twice." << endl; cerr.flush(); exit(-1); } // save pointer to yourself pGlobalConsedParameters_ = this; // remember you have been created (allow no others) bConsedParametersCreated_ = true; #ifdef NO_POUND_POUND_MACROS #define saveAConsedParameter( nameWithoutFinalUnderscore ) \ consedParameters::pGetConsedParameters()->nameWithoutFinalUnderscore ## _ \ = pRes->nameWithoutFinalUnderscore ## _ #else #define saveAConsedParameter( nameWithoutFinalUnderscore ) \ consedParameters::pGetConsedParameters()-> ## nameWithoutFinalUnderscore ## _ \ = pRes-> ## nameWithoutFinalUnderscore ## _ #endif // This macro expands saveAConsedParameter( nPrimersMaxSelfMatchScore ) // into // consedParameters::pGetConsedParameters()->nPrimersMaxSelfMatchScore_ // = pRes->nPrimersMaxSelfMatchScore_ if ( pRes->bShowProteinTranslation_ == true ) { consedParameters::pGetConsedParameters()->nShowProteinTranslation_ = nShowProteinTranslationTopStrand; } else { consedParameters::pGetConsedParameters()->nShowProteinTranslation_ = nDontShowProteinTranslation; }