/***************************************************************************** # 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 #include #include #include #include #include #include #include "guiSetPrimerPickingPreferences.h" #include "assert.h" #include "quality.h" #include "consedParameters.h" #include "guiapp.h" #include #include #include "rwcstring.h" #include "rwcregexp.h" #include "bIsNumericMaybeWithWhitespace.h" #include "numutil.h" #include "handleWindowManagerDelete2.h" #include "nPrimerFalseMatchScoreArray.h" #include "popupErrorMessage.h" #include "primerType.h" #include "hp_exception_kludge.h" #include "bIsNumericDouble.h" #include "consed.h" // the following #define will take // makeLabelAndInputField( VerticalTraceMagnification ) // and make: // Widget widVerticalTraceMagnificationForm = XtVaCreateManagedWidget( "form", // xmFormWidgetClass, // widRowCol, // XmNshadowThickness, 0, // NULL ); // Widget widVerticalTraceMagnificationLabel = XtVaCreateManagedWidget( // "Vertical Trace Magnification", // xmLabelWidgetClass, // widVerticalTraceMagnificationForm, // XmNtopAttachment, XmATTACH_FORM, // XmNbottomAttachment, XmATTACH_FORM, // XmNleftAttachment, XmATTACH_FORM, // XmNrightAttachment, XmATTACH_POSITION, // XmNrightPosition, nRightPositionOfLabels, // XmNalignment, XmALIGNMENT_END, // NULL ); // char szVerticalTraceMagnification[200]; // sprintf( szVerticalTraceMagnification, "%d", // consedParameters::pGetConsedParameters()->nVerticalTraceMagnification_ ); // widVerticalTraceMagnification_ = XtVaCreateManagedWidget( // "vertical trace magnification", // xmTextFieldWidgetClass, // widVerticalTraceMagnificationForm, // XmNtraversalOn, True, // XmNtopAttachment, XmATTACH_FORM, // XmNbottomAttachment, XmATTACH_FORM, // XmNleftAttachment, XmATTACH_POSITION, // XmNleftPosition, 80, // XmNrightAttachment, XmATTACH_FORM, // XmNvalue, szVerticalTraceMagnification, // NULL ); // XtAddCallback( widVerticalTraceMagnification_, // XmNactivateCallback, // (XtCallbackProc )XmProcessTraversal, // (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); static const int nRightPositionOfLabels = 70; static const int nLeftPositionOfInputFields = 80; #define makeLabelAndInputField( parameterNameWithoutPrefix ) \ Widget wid ## parameterNameWithoutPrefix ## Form = XtVaCreateManagedWidget( "form", \ xmFormWidgetClass, \ widRowCol,\ XmNshadowThickness, 0,\ NULL );\ \ Widget wid ## parameterNameWithoutPrefix ## Label = XtVaCreateManagedWidget( \ #parameterNameWithoutPrefix , \ xmLabelWidgetClass, \ wid ## parameterNameWithoutPrefix ## Form, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_FORM, \ XmNrightAttachment, XmATTACH_POSITION, \ XmNrightPosition, nRightPositionOfLabels, \ XmNalignment, XmALIGNMENT_END, \ NULL ); \ \ char sz ## parameterNameWithoutPrefix[200]; \ sprintf( sz ## parameterNameWithoutPrefix, "%d", \ consedParameters::pGetConsedParameters()->n ## parameterNameWithoutPrefix ## _ ); \ \ \ wid ## parameterNameWithoutPrefix ## _ = XtVaCreateManagedWidget( \ #parameterNameWithoutPrefix , \ xmTextFieldWidgetClass, \ wid ## parameterNameWithoutPrefix ## Form, \ XmNtraversalOn, True, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_POSITION, \ XmNleftPosition, nLeftPositionOfInputFields, \ XmNrightAttachment, XmATTACH_FORM, \ XmNvalue, sz ## parameterNameWithoutPrefix , \ NULL ); \ \ XtAddCallback( wid ## parameterNameWithoutPrefix ## _, \ XmNactivateCallback, \ (XtCallbackProc )XmProcessTraversal, \ (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); #define makeLabelAndInputFieldForDouble( parameterNameWithoutPrefix ) \ Widget wid ## parameterNameWithoutPrefix ## Form = XtVaCreateManagedWidget( "form", \ xmFormWidgetClass, \ widRowCol,\ XmNshadowThickness, 0,\ NULL );\ \ Widget wid ## parameterNameWithoutPrefix ## Label = XtVaCreateManagedWidget( \ #parameterNameWithoutPrefix , \ xmLabelWidgetClass, \ wid ## parameterNameWithoutPrefix ## Form, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_FORM, \ XmNrightAttachment, XmATTACH_POSITION, \ XmNrightPosition, nRightPositionOfLabels, \ XmNalignment, XmALIGNMENT_END, \ NULL ); \ \ char sz ## parameterNameWithoutPrefix[200]; \ sprintf( sz ## parameterNameWithoutPrefix, "%g", \ consedParameters::pGetConsedParameters()->d ## parameterNameWithoutPrefix ## _ ); \ \ \ wid ## parameterNameWithoutPrefix ## _ = XtVaCreateManagedWidget( \ #parameterNameWithoutPrefix , \ xmTextFieldWidgetClass, \ wid ## parameterNameWithoutPrefix ## Form, \ XmNtraversalOn, True, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_POSITION, \ XmNleftPosition, nLeftPositionOfInputFields, \ XmNrightAttachment, XmATTACH_FORM, \ XmNvalue, sz ## parameterNameWithoutPrefix , \ NULL ); \ \ XtAddCallback( wid ## parameterNameWithoutPrefix ## _, \ XmNactivateCallback, \ (XtCallbackProc )XmProcessTraversal, \ (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); #define createLineWithBooleanConsedParameter( basename, szLabel, szTrueButtonLabel, szFalseButtonLabel ) \ \ Widget wid ## basename ## Form = XtVaCreateManagedWidget( \ "form", \ xmFormWidgetClass, \ widRowCol, \ XmNshadowThickness, 0, \ NULL ); \ \ xm = XmStringCreateLtoR( szLabel, XmFONTLIST_DEFAULT_TAG ); \ \ Widget wid ## basename ## Label = XtVaCreateManagedWidget( \ szLabel, \ xmLabelWidgetClass, \ wid ## basename ## Form, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_FORM, \ XmNrightAttachment, XmATTACH_POSITION, \ XmNrightPosition, 60, \ XmNalignment, XmALIGNMENT_END, \ XmNlabelString, xm, \ NULL ); \ \ XmStringFree( xm ); \ \ Widget wid ## basename ## RadioBox = XmCreateRadioBox( \ wid ## basename ## Form, \ "radio", \ NULL , \ 0 ); \ \ XtVaSetValues( \ wid ## basename ## RadioBox, \ XmNtraversalOn, True, \ XmNtopAttachment, XmATTACH_FORM, \ XmNbottomAttachment, XmATTACH_FORM, \ XmNleftAttachment, XmATTACH_POSITION, \ XmNleftPosition, 70, \ XmNrightAttachment, XmATTACH_FORM, \ XmNorientation, XmHORIZONTAL, \ XmNshadowThickness, 0, \ XmNborderWidth, 0, \ XmNmarginWidth, 0, \ NULL ); \ \ bool b ## basename = \ consedParameters::pGetConsedParameters()->b ## basename ## _; \ \ wid ## basename ## True_ = XtVaCreateManagedWidget( \ szTrueButtonLabel, \ xmToggleButtonWidgetClass, \ wid ## basename ## RadioBox, \ XmNset, b ## basename, \ NULL ); \ \ Widget wid ## basename ## False = XtVaCreateManagedWidget( \ szFalseButtonLabel, \ xmToggleButtonWidgetClass, \ wid ## basename ## RadioBox, \ XmNset, !b ## basename, \ NULL ); \ \ XtManageChild( wid ## basename ## RadioBox ); // createLineWithBooleanConsedParameter( CountPads, "Count *'s", "True", "False" ); // makes: ///////////////////// // // whether to count *'s or not // Widget widCountPadsForm = XtVaCreateManagedWidget( // "form", // xmFormWidgetClass, // widRowCol, // XmNshadowThickness, 0, // NULL ); // Widget widCountPadsLabel = XtVaCreateManagedWidget( // "Count *'s", // xmLabelWidgetClass, // widCountPadsForm, // XmNtopAttachment, XmATTACH_FORM, // XmNbottomAttachment, XmATTACH_FORM, // XmNleftAttachment, XmATTACH_FORM, // XmNrightAttachment, XmATTACH_POSITION, // XmNrightPosition, 60, // XmNalignment, XmALIGNMENT_END, // NULL ); // Widget widCountPadsRadioBox = XmCreateRadioBox( // widCountPadsForm, // "radio", // NULL, // 0 ); // XtVaSetValues( // widCountPadsRadioBox, // XmNtraversalOn, True, // XmNtopAttachment, XmATTACH_FORM, // XmNbottomAttachment, XmATTACH_FORM, // XmNleftAttachment, XmATTACH_POSITION, // XmNleftPosition, 70, // XmNrightAttachment, XmATTACH_FORM, // XmNorientation, XmHORIZONTAL, // XmNshadowThickness, 0, // XmNborderWidth, 0, // XmNmarginWidth, 0, // NULL ); // bool bCountPads = consedParameters::pGetConsedParameters()->bCountPads_; // widCountPadsTrue_ = XtVaCreateManagedWidget( // "True", // xmToggleButtonWidgetClass, // widCountPadsRadioBox, // XmNset, bCountPads, // NULL ); // Widget widCountPadsFalse = XtVaCreateManagedWidget( // "False", // xmToggleButtonWidgetClass, // widCountPadsRadioBox, // XmNset, !bCountPads, // NULL ); // XtManageChild( widCountPadsRadioBox ); #define checkIfNumeric( PrimersParameter ) \ szValue = XmTextFieldGetString( wid ## PrimersParameter ## _ );\ soValue = szValue; \ XtFree( szValue ); \ int nPerhaps ## PrimersParameter; \ if ( !bIsNumericMaybeWithWhitespace( soValue, nPerhaps ## PrimersParameter ) ) { \ popupErrorMessage( #PrimersParameter " must be numeric" ); \ return; \ } //checkIfNumeric( PrimersMinMeltingTempForPCR ) // will expand to: // // // szValue = XmTextFieldGetString( widPrimersMinMeltingTempForPCR_ ); // soValue = szValue; // XtFree( szValue ); // int nPerhapsPrimerMinMeltingTempForPCR; // if ( !bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimerMinMeltingTempForPCR ) ) { // popupErrorMessage( "PrimersMinMeltingTempForPCR must be numeric" ); // return; // } #define putIntegerIntoConsedParameters( PrimersParameter ) \ consedParameters::pGetConsedParameters()->n ## PrimersParameter ## _ = \ nPerhaps ## PrimersParameter; // putIntegerIntoConsedParameters( PrimersMinMeltingTempForPCR ); // will expand into: // consedParameters::pGetConsedParameters()->nPrimersMinMeltingTempForPCR_ = // nPerhapsPrimersMinMeltingTempForPCR; #define checkIfNumericDouble( PrimersParameter ) \ szValue = XmTextFieldGetString( wid ## PrimersParameter ## _ );\ soValue = szValue; \ XtFree( szValue ); \ double dPerhaps ## PrimersParameter; \ if ( !bIsNumericDouble( soValue, dPerhaps ## PrimersParameter ) ) { \ popupErrorMessage( #PrimersParameter " must be numeric (floating point)" ); \ return; \ } #define putDoubleIntoConsedParameters( PrimersParameter ) \ consedParameters::pGetConsedParameters()->d ## PrimersParameter ## _ = \ dPerhaps ## PrimersParameter; static void cbGuiSetPrimerPickingPreferencesCancelButton( Widget wid, XtPointer clientData, XtPointer pCallData ) { guiSetPrimerPickingPreferences* pGuiSetPrimerPickingPreferences = (guiSetPrimerPickingPreferences* )clientData; delete pGuiSetPrimerPickingPreferences; } guiSetPrimerPickingPreferences :: guiSetPrimerPickingPreferences() { int nArgs; Arg aArg[50]; widPopupShell_ = XtVaCreatePopupShell("Primer Picking Preferences", topLevelShellWidgetClass, GuiApp::pGetGuiApp()->widGetTopLevel(), XmNtitle, "Primer Picking Preferences", XmNnoResize, False, XmNautoUnmanage, False, XmNtransient, False, XmNdeleteResponse, XmDO_NOTHING, NULL ); handleWindowManagerDelete2( widPopupShell_, cbGuiSetPrimerPickingPreferencesCancelButton, this ); // // create the form widget // nArgs = 0; XtSetArg(aArg[nArgs],XmNshadowThickness,0); nArgs++; XtSetArg(aArg[nArgs],XmNborderWidth,0); nArgs++; Widget widTopForm = XmCreateForm(widPopupShell_, "form", aArg, nArgs); XtManageChild(widTopForm); widOKButton_ = XtVaCreateManagedWidget( "Apply & Dismiss", xmPushButtonWidgetClass, widTopForm, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNtraversalOn, False, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 16, NULL ); XtAddCallback(widOKButton_, XmNactivateCallback, (XtCallbackProc )cbGuiSetPrimerPickingPreferencesOKButton, this); widCancelButton_ = XtVaCreateManagedWidget( "Cancel", xmPushButtonWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, widOKButton_, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNtraversalOn, False, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 84, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 96, NULL ); XtAddCallback(widCancelButton_, XmNactivateCallback, (XtCallbackProc )cbGuiSetPrimerPickingPreferencesCancelButton, this); Widget widScrolledWindow = XtVaCreateManagedWidget( "scrolled", xmScrolledWindowWidgetClass, widTopForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widOKButton_, XmNbottomOffset, 20, XmNscrollingPolicy, XmAUTOMATIC, XmNscrollBarDisplayPolicy, XmSTATIC, NULL ); const int nWidthOfForm = 80; Widget widForm = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widScrolledWindow, XmNwidth, (Dimension) (GuiApp::pGetGuiApp()->nGetFontWidth() * nWidthOfForm), NULL ); // XmScrolledWindowSetAreas( widScrolledWindow, // (Widget) NULL, // (Widget) NULL, // widForm ); //szPrimersCloneFullPathnameOfFileOfSequencesForScreening_ widPrimersCloneFullPathnameOfFileOfSequencesForScreening_ = XtVaCreateManagedWidget( "full pathname of file of sequences used to screen primers", xmTextFieldWidgetClass, widForm, XmNtraversalOn, True, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNvalue, (char*) consedParameters::pGetConsedParameters()->soPrimersCloneFullPathnameOfFileOfSequencesForScreening_.data(), NULL ); XtAddCallback( widPrimersCloneFullPathnameOfFileOfSequencesForScreening_, XmNactivateCallback, (XtCallbackProc )XmProcessTraversal, (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); Widget widPrimersCloneFullPathnameOfFileOfSequencesUsedToScreenPrimersLabel = XtVaCreateManagedWidget( "Full Pathname of File of Sequences Used To Screen Primers (clone template):", xmLabelWidgetClass, widForm, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersCloneFullPathnameOfFileOfSequencesForScreening_, XmNbottomOffset, 0, NULL ); //szPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_ widPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_ = XtVaCreateManagedWidget( "full pathname of file of sequences used to screen primers", xmTextFieldWidgetClass, widForm, XmNtraversalOn, True, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersCloneFullPathnameOfFileOfSequencesUsedToScreenPrimersLabel, //widPrimersCloneFullPathnameOfFileOfSequencesForScreening_, XmNbottomOffset, 20, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNvalue, (char*) consedParameters::pGetConsedParameters()->soPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_.data(), NULL ); XtAddCallback( widPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_, XmNactivateCallback, (XtCallbackProc )XmProcessTraversal, (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); Widget widPrimersSubcloneFullPathnameOfFileOfSequencesUsedToScreenPrimersLabel = XtVaCreateManagedWidget( "Full Pathname of File of Sequences Used To Screen Primers (subclone template):", xmLabelWidgetClass, widForm, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_, XmNbottomOffset, 0, NULL ); // filPrimersBadTemplatesFile_ widPrimersBadTemplatesFile_ = XtVaCreateManagedWidget( "filename of file containing bad templates", xmTextFieldWidgetClass, widForm, XmNtraversalOn, True, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersSubcloneFullPathnameOfFileOfSequencesUsedToScreenPrimersLabel, XmNbottomOffset, 20, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNvalue, (char*) consedParameters::pGetConsedParameters()->filPrimersBadTemplatesFile_.data(), NULL ); XtAddCallback( widPrimersBadTemplatesFile_, XmNactivateCallback, (XtCallbackProc) XmProcessTraversal, (XtPointer) XmTRAVERSE_NEXT_TAB_GROUP ); XmString xmLabel = XmStringCreateLtoR( "File of templates you do not want the primer picker to choose.\n(Not full pathname--assumed to be in the same directory as the ace file):", XmFONTLIST_DEFAULT_TAG ); Widget widPrimersBadTemplatesFileLabel = XtVaCreateManagedWidget( "File in edit_dir of Templates that you do not the primer picker to choose:", xmLabelWidgetClass, widForm, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersBadTemplatesFile_, XmNbottomOffset, 0, XmNlabelString, xmLabel, NULL ); XmStringFree( xmLabel ); // now comes the fields that are all of the same form Widget widRowCol = XtVaCreateManagedWidget( "rowcol", xmRowColumnWidgetClass, widForm, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, widPrimersBadTemplatesFileLabel, XmNbottomOffset, 20, XmNorientation, XmVERTICAL, XmNnumColumns, 1, XmNpacking, XmPACK_COLUMN, NULL ); // needed by the #define macros char szTemp[200]; XmString xm; // makeLabelAndInputField( PrimersWindowSizeInLooking ); makeLabelAndInputField( PrimersWindowSizeInLooking ); makeLabelAndInputField( PrimersWindowSizeInLookingForPCR ); makeLabelAndInputField( PrimersMinimumLengthOfAPrimer ); makeLabelAndInputField( PrimersMaximumLengthOfAPrimer ); makeLabelAndInputField( PrimersMinimumLengthOfAPrimerForPCR ); makeLabelAndInputField( PrimersMaximumLengthOfAPrimerForPCR ); makeLabelAndInputField( AutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize ); // eliminated (Aug 2000): // PrimersALittleLessThanAverageInsertSizeOfASubclone ); makeLabelAndInputField( PrimersMaxInsertSizeOfASubclone ); makeLabelAndInputField( PrimersMinMeltingTemp ); makeLabelAndInputField( PrimersMaxMeltingTemp ); makeLabelAndInputField( PrimersMinMeltingTempForPCR ); makeLabelAndInputField( PrimersMaxMeltingTempForPCR ); makeLabelAndInputFieldForDouble( PrimersMaxMeltingTempDifferenceForPCR ); makeLabelAndInputField( PrimersMaxSelfMatchScore ); makeLabelAndInputField( PrimersMaxPrimerDimerScoreForPCR ); makeLabelAndInputField( PrimersMaxMatchElsewhereScore ); makeLabelAndInputField( PrimersMaxMatchElsewhereScoreForPCR ); makeLabelAndInputField( PrimersMinQuality ); makeLabelAndInputField( PrimersNumberOfBasesToBackUpToStartLooking ); makeLabelAndInputField( PrimersMaxLengthOfMononucleotideRepeat ); makeLabelAndInputField( PrimersNumberOfTemplatesToDisplayInFront ); makeLabelAndInputField( PrimersMinNumberOfTemplatesForPrimers ); // The default values will not show too many pcr primer pairs // (around 100). If the user wants to see all pcr primer pairs, // let him see them all, even if it takes a long time. // makeLabelAndInputField( PrimersMaxPCRPrimerPairsToDisplay ); // makeLabelAndInputField( PrimersDNAConcentrationNanomolar ); // makeLabelAndInputField( PrimersSaltConcentrationMillimolar ); Widget widPrimersScreenForVectorForm = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widRowCol, XmNshadowThickness, 0, NULL ); Widget widScreenForVectorLabel = XtVaCreateManagedWidget( "Screen Primers Against Sequences in File?", xmLabelWidgetClass, widPrimersScreenForVectorForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, XmNalignment, XmALIGNMENT_END, NULL ); Widget widPrimersScreenForVectorRadioBox = XmCreateRadioBox( widPrimersScreenForVectorForm, "radio", NULL, 0 ); XtVaSetValues( widPrimersScreenForVectorRadioBox, XmNtraversalOn, True, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 70, XmNrightAttachment, XmATTACH_FORM, XmNorientation, XmHORIZONTAL, XmNshadowThickness,0, XmNborderWidth, 0, XmNmarginWidth, 0, NULL ); bool bPrimersScreenForVector = consedParameters::pGetConsedParameters()->bPrimersScreenForVector_; widPrimersScreenForVectorTrue_ = XtVaCreateManagedWidget( "True", xmToggleButtonWidgetClass, widPrimersScreenForVectorRadioBox, XmNset, bPrimersScreenForVector, NULL ); Widget widPrimersScreenForVectorFalse = XtVaCreateManagedWidget( "False", xmToggleButtonWidgetClass, widPrimersScreenForVectorRadioBox, XmNset, !bPrimersScreenForVector, NULL ); XtManageChild( widPrimersScreenForVectorRadioBox ); // screen primers to make sure they have a template Widget widPickTemplatesForm = XtVaCreateManagedWidget( "form", xmFormWidgetClass, widRowCol, XmNshadowThickness, 0, NULL ); Widget widPickTemplatesLabel = XtVaCreateManagedWidget( "Pick subclone templates for primers?", xmLabelWidgetClass, widPickTemplatesForm, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 60, XmNalignment, XmALIGNMENT_END, NULL ); Widget widPickTemplatesRadioBox = XmCreateRadioBox( widPickTemplatesForm, "radio", NULL, 0 ); XtVaSetValues( widPickTemplatesRadioBox, XmNtraversalOn, True, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 70, XmNrightAttachment, XmATTACH_FORM, XmNorientation, XmHORIZONTAL, XmNshadowThickness,0, XmNborderWidth, 0, XmNmarginWidth, 0, NULL ); bool bPickTemplates = consedParameters::pGetConsedParameters()->bPrimersPickTemplatesForPrimers_; widPickTemplatesTrue_ = XtVaCreateManagedWidget( "True", xmToggleButtonWidgetClass, widPickTemplatesRadioBox, XmNset, bPickTemplates, NULL ); Widget widPickTemplatesFalse = XtVaCreateManagedWidget( "False", xmToggleButtonWidgetClass, widPickTemplatesRadioBox, XmNset, !bPickTemplates, NULL ); XtManageChild( widPickTemplatesRadioBox ); createLineWithBooleanConsedParameter( PrimersCheckJustSomePCRPrimerPairsRatherThanAll, "Check All PCR Pairs (huge) or Just a Sample?", "Sample", "All" ); createLineWithBooleanConsedParameter( PrimersOKToChoosePrimersInSingleSubcloneRegion, "OK to choose primers in single subclone region?", "Yes", "No" ); createLineWithBooleanConsedParameter( PrimersOKToChoosePrimersWhereHighQualityDiscrepancies, "OK to choose primers where high qual discrep?", "Yes", "No" ); createLineWithBooleanConsedParameter( PrimersOKToChoosePrimersWhereUnalignedHighQualityRegion, "OK to choose primers where unaligned high quality?", "Yes", "No" ); // these values have been set empirically. XtVaSetValues( widScrolledWindow, XmNwidth, (Dimension) (GuiApp::pGetGuiApp()->nGetFontWidth() * ( nWidthOfForm + 4) ), XmNheight, GuiApp::pGetGuiApp()->nGetFontHeight() * 40, NULL ); XtPopup( widPopupShell_, XtGrabNone ); } void cbGuiSetPrimerPickingPreferencesOKButton( Widget wid, XtPointer clientData, XmAnyCallbackStruct* cbs) { guiSetPrimerPickingPreferences* pGuiSetPrimerPickingPreferences = (guiSetPrimerPickingPreferences* )clientData; TRY_CATCH_WRAPPER( assert( wid == pGuiSetPrimerPickingPreferences->widOKButton_ ); pGuiSetPrimerPickingPreferences->userPushedOKButton(); ); } static void cbGuiSetPrimerPickingPreferencesCancelButton( Widget wid, XtPointer clientData, XmAnyCallbackStruct* cbs) { guiSetPrimerPickingPreferences* pGuiSetPrimerPickingPreferences = (guiSetPrimerPickingPreferences* )clientData; TRY_CATCH_WRAPPER( delete pGuiSetPrimerPickingPreferences; ); } void guiSetPrimerPickingPreferences :: userPushedOKButton() { // set nPrimersWindowSizeInLooking char* szValue = XmTextFieldGetString( widPrimersWindowSizeInLooking_ ); RWCString soValue( szValue ); XtFree( szValue ); int nPerhapsPrimersWindowSizeInLooking; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersWindowSizeInLooking ) ) { popupErrorMessage( "primers window size in looking must be numeric" ); return; } if (! ( 0 <= nPerhapsPrimersWindowSizeInLooking ) ) { char szError[200]; sprintf( szError, "primers window size in looking must be positive" ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersWindowSizeInLooking_ = nPerhapsPrimersWindowSizeInLooking; // nPrimersWindowSizeInLookingForPCR_ checkIfNumeric( PrimersWindowSizeInLookingForPCR ); if ( ! ( 0 < nPerhapsPrimersWindowSizeInLookingForPCR ) ) { popupErrorMessage( "PrimersWindowSizeInLookingForPCR must be positive" ); return; } putIntegerIntoConsedParameters( PrimersWindowSizeInLookingForPCR ); // nPrimersMinimumLengthOfAPrimer szValue = XmTextFieldGetString( widPrimersMinimumLengthOfAPrimer_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMinimumLengthOfAPrimer; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMinimumLengthOfAPrimer ) ) { popupErrorMessage( "nPrimersMinimumLengthOfAPrimer must be numeric" ); return; } if (! ( 0 < nPerhapsPrimersMinimumLengthOfAPrimer ) ) { char szError[200]; sprintf( szError, "nPrimersMinimumLengthOfAPrimer must be positive" ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMinimumLengthOfAPrimer_ = nPerhapsPrimersMinimumLengthOfAPrimer; // nPrimersMaximumLengthOfAPrimer szValue = XmTextFieldGetString( widPrimersMaximumLengthOfAPrimer_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaximumLengthOfAPrimer; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaximumLengthOfAPrimer ) ) { popupErrorMessage( "Maximum Length Of A Primer must be numeric" ); return; } if (! ( 0 < nPerhapsPrimersMaximumLengthOfAPrimer ) ) { char szError[200]; sprintf( szError, "Maximum Length Of A Primer must be positive" ); popupErrorMessage( szError ); return; } if ( nPerhapsPrimersMaximumLengthOfAPrimer > nMaxLengthOfPrimers ) { char szError[200]; sprintf( szError, "Maximum Length Of A Primer cannot exceed %d", nMaxLengthOfPrimers ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMaximumLengthOfAPrimer_ = nPerhapsPrimersMaximumLengthOfAPrimer; // nPrimersMinimumLengthOfAPrimerForPCR_ // nPrimersMaximumLengthOfAPrimerForPCR_ checkIfNumeric( PrimersMinimumLengthOfAPrimerForPCR ); checkIfNumeric( PrimersMaximumLengthOfAPrimerForPCR ); if ( ! ( 0 < nPerhapsPrimersMinimumLengthOfAPrimerForPCR ) ) { popupErrorMessage( "PrimersMinimumLengthOfAPrimerForPCR must be positive" ); return; } if ( ! ( 0 < nPerhapsPrimersMaximumLengthOfAPrimerForPCR ) ) { popupErrorMessage( "PrimersMaximumLengthOfAPrimerForPCR must be positive" ); return; } if ( ! ( nPerhapsPrimersMinimumLengthOfAPrimerForPCR <= nPerhapsPrimersMaximumLengthOfAPrimerForPCR ) ) { popupErrorMessage( "PrimersMinimumLengthOfAPrimerForPCR must be <= PrimersMaximumLengthOfAPrimerForPCR" ); return; } if ( nPerhapsPrimersMaximumLengthOfAPrimerForPCR > nMaxLengthOfPrimers ) { popupErrorMessage( "Maximum length of a primer cannot exceed %d", nMaxLengthOfPrimers ); return; } putIntegerIntoConsedParameters( PrimersMinimumLengthOfAPrimerForPCR ); putIntegerIntoConsedParameters( PrimersMaximumLengthOfAPrimerForPCR ); // nPrimersNumberOfTemplatesToDisplayInFront_ szValue = XmTextFieldGetString( widPrimersNumberOfTemplatesToDisplayInFront_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersNumberOfTemplatesToDisplayInFront; if ( !bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersNumberOfTemplatesToDisplayInFront ) ) { popupErrorMessage( "nPrimersNumberOfTemplatesToDisplayInFront_ must be numeric" ); return; } if ( ! ( ( 1 <= nPerhapsPrimersNumberOfTemplatesToDisplayInFront ) && ( nPerhapsPrimersNumberOfTemplatesToDisplayInFront <= nNUMBER_OF_TEMPLATES ) ) ) { popupErrorMessage( "nPrimersNumberOfTemplatesToDisplayInFront_ must be between 1 and %d", nNUMBER_OF_TEMPLATES ); return; } consedParameters::pGetConsedParameters()->nPrimersNumberOfTemplatesToDisplayInFront_ = nPerhapsPrimersNumberOfTemplatesToDisplayInFront; // nPrimersMinNumberOfTemplatesForPrimers checkIfNumeric( PrimersMinNumberOfTemplatesForPrimers ); putIntegerIntoConsedParameters( PrimersMinNumberOfTemplatesForPrimers ); // nAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize_ szValue = XmTextFieldGetString( widAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize_ ); soValue = szValue; XtFree( szValue ); int nPerhapsAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize ) ) { popupErrorMessage( "AutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize must be numeric" ); return; } if ( ! ( 0 < nPerhapsAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize ) ) { popupErrorMessage( "MAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize must be positive" ); return; } consedParameters::pGetConsedParameters()->nAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize_ = nPerhapsAutoFinishIfNotEnoughFwdRevPairsUseThisPerCentOfInsertSize; // nPrimersMaxInsertSizeOfASubclone szValue = XmTextFieldGetString( widPrimersMaxInsertSizeOfASubclone_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaxInsertSizeOfASubclone; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaxInsertSizeOfASubclone ) ) { popupErrorMessage( "Maximum Length Of A Clone must be numeric" ); return; } if (! ( 0 < nPerhapsPrimersMaxInsertSizeOfASubclone ) ) { char szError[200]; sprintf( szError, "Maximum Length Of A Clone must be positive" ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMaxInsertSizeOfASubclone_ = nPerhapsPrimersMaxInsertSizeOfASubclone; // nPrimersMinMeltingTemp szValue = XmTextFieldGetString( widPrimersMinMeltingTemp_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMinMeltingTemp; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMinMeltingTemp ) ) { popupErrorMessage( "Min Melting Temp must be numeric" ); return; } // nPrimersMaxMeltingTemp szValue = XmTextFieldGetString( widPrimersMaxMeltingTemp_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaxMeltingTemp; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaxMeltingTemp ) ) { popupErrorMessage( "Max Melting Temp must be numeric" ); return; } if (! (nPerhapsPrimersMinMeltingTemp <= nPerhapsPrimersMaxMeltingTemp ) ) { popupErrorMessage( "Min Melting Temp must be <= Max Melting Temp" ); return; } consedParameters::pGetConsedParameters()->nPrimersMinMeltingTemp_ = nPerhapsPrimersMinMeltingTemp; consedParameters::pGetConsedParameters()->nPrimersMaxMeltingTemp_ = nPerhapsPrimersMaxMeltingTemp; // nPrimersMinMeltingTempForPCR // nPrimersMaxMeltingTempForPCR checkIfNumeric( PrimersMinMeltingTempForPCR ); checkIfNumeric( PrimersMaxMeltingTempForPCR ); if ( nPerhapsPrimersMinMeltingTempForPCR > nPerhapsPrimersMaxMeltingTempForPCR ) { popupErrorMessage( "Min Melting Temp for PCR must be <= Max Melting Temp for PCR. Have a nice day!" ); return; } putIntegerIntoConsedParameters( PrimersMinMeltingTempForPCR ); putIntegerIntoConsedParameters( PrimersMaxMeltingTempForPCR ); // dPrimersMaxMeltingTempDifferenceForPCR checkIfNumericDouble( PrimersMaxMeltingTempDifferenceForPCR ); if ( dPerhapsPrimersMaxMeltingTempDifferenceForPCR < 0 ) { popupErrorMessage( "PrimersMaxMeltingTempDifferenceForPCR must not be negative. (If you managed to get this message, you may be a winner already!)" ); return; } putDoubleIntoConsedParameters( PrimersMaxMeltingTempDifferenceForPCR ); // nPrimersMaxSelfMatchScore szValue = XmTextFieldGetString( widPrimersMaxSelfMatchScore_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaxSelfMatchScore; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaxSelfMatchScore ) ) { popupErrorMessage( "Maximum Length Of A Clone must be numeric" ); return; } if (! ( 0 <= nPerhapsPrimersMaxSelfMatchScore ) ) { char szError[200]; sprintf( szError, "Maximum Self-Match Score must be >= 0" ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMaxSelfMatchScore_ = nPerhapsPrimersMaxSelfMatchScore; // nPrimersMaxPrimerDimerScoreForPCR_ checkIfNumeric( PrimersMaxPrimerDimerScoreForPCR ); putIntegerIntoConsedParameters( PrimersMaxPrimerDimerScoreForPCR ); // nPrimersMaxMatchElsewhereScore szValue = XmTextFieldGetString( widPrimersMaxMatchElsewhereScore_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaxMatchElsewhereScore; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaxMatchElsewhereScore ) ) { popupErrorMessage( "Max Match Elsewhere Score" ); return; } if (! ( 0 <= nPerhapsPrimersMaxMatchElsewhereScore ) ) { char szError[200]; sprintf( szError, "Max Match Elsewhere Score must be >= 0" ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMaxMatchElsewhereScore_ = nPerhapsPrimersMaxMatchElsewhereScore; // nPrimersMaxMatchElsewhereScoreForPCR checkIfNumeric( PrimersMaxMatchElsewhereScoreForPCR ); if ( nPerhapsPrimersMaxMatchElsewhereScoreForPCR <= 0 ) { popupErrorMessage( "PrimersMaxMatchElsewhereScoreForPCR must be positive" ); return; } putIntegerIntoConsedParameters( PrimersMaxMatchElsewhereScoreForPCR ); // nPrimersMinQuality szValue = XmTextFieldGetString( widPrimersMinQuality_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMinQuality; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMinQuality ) ) { popupErrorMessage( "Min Quality in Primer must be numeric" ); return; } if (! (ucQualityMin <= nPerhapsPrimersMinQuality && nPerhapsPrimersMinQuality <= ucQualityMax ) ) { char szError[200]; sprintf( szError, "primer min quality must be between %d and %d ", ucQualityMin, ucQualityMax ); popupErrorMessage( szError ); return; } consedParameters::pGetConsedParameters()->nPrimersMinQuality_ = nPerhapsPrimersMinQuality; // nPrimersNumberOfBasesToBackUpToStartLooking szValue = XmTextFieldGetString( widPrimersNumberOfBasesToBackUpToStartLooking_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersNumberOfBasesToBackUpToStartLooking; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersNumberOfBasesToBackUpToStartLooking ) ) { popupErrorMessage( "PrimersNumberOfBasesToBackUpToStartLooking must be numeric" ); return; } consedParameters::pGetConsedParameters()->nPrimersNumberOfBasesToBackUpToStartLooking_ = nPerhapsPrimersNumberOfBasesToBackUpToStartLooking; // bPrimersScreenForVector_ consedParameters::pGetConsedParameters()->bPrimersScreenForVector_ = XmToggleButtonGetState( widPrimersScreenForVectorTrue_ ); // bPrimersPickTemplatesForPrimers_ consedParameters::pGetConsedParameters()->bPrimersPickTemplatesForPrimers_ = XmToggleButtonGetState( widPickTemplatesTrue_ ); // bPrimersCheckJustSomePCRPrimerPairsRatherThanAll_ pCP->bPrimersCheckJustSomePCRPrimerPairsRatherThanAll_ = XmToggleButtonGetState( widPrimersCheckJustSomePCRPrimerPairsRatherThanAllTrue_ ); // if the user is changing bPrimersOKToChoosePrimersInSingleSubcloneRegion_ // or bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_ // or bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_ // then the problems array must be recalculated for each contig if ( ( pCP->bPrimersOKToChoosePrimersInSingleSubcloneRegion_ != XmToggleButtonGetState( widPrimersOKToChoosePrimersInSingleSubcloneRegionTrue_ ) ) || ( pCP->bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_ != XmToggleButtonGetState( widPrimersOKToChoosePrimersWhereUnalignedHighQualityRegionTrue_ ) ) || ( pCP->bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_ != XmToggleButtonGetState( widPrimersOKToChoosePrimersWhereUnalignedHighQualityRegionTrue_ ) ) ) { ConsEd::pGetAssembly()->clearAllContigProblemArrays(); } // bPrimersOKToChoosePrimersInSingleSubcloneRegion_ pCP->bPrimersOKToChoosePrimersInSingleSubcloneRegion_ = XmToggleButtonGetState( widPrimersOKToChoosePrimersInSingleSubcloneRegionTrue_ ); // bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_ pCP->bPrimersOKToChoosePrimersWhereHighQualityDiscrepancies_ = XmToggleButtonGetState( widPrimersOKToChoosePrimersWhereHighQualityDiscrepanciesTrue_ ); // bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_ pCP->bPrimersOKToChoosePrimersWhereUnalignedHighQualityRegion_ = XmToggleButtonGetState( widPrimersOKToChoosePrimersWhereUnalignedHighQualityRegionTrue_ ); // szPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_ szValue = XmTextFieldGetString( widPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_ ); consedParameters::pGetConsedParameters()->soPrimersSubcloneFullPathnameOfFileOfSequencesForScreening_ = szValue; XtFree( szValue ); // szPrimersCloneFullPathnameOfFileOfSequencesForScreening_ szValue = XmTextFieldGetString( widPrimersCloneFullPathnameOfFileOfSequencesForScreening_ ); consedParameters::pGetConsedParameters()->soPrimersCloneFullPathnameOfFileOfSequencesForScreening_ = szValue; XtFree( szValue ); // filPrimersBadTemplatesFile_ szValue = XmTextFieldGetString( widPrimersBadTemplatesFile_ ); consedParameters::pGetConsedParameters()->filPrimersBadTemplatesFile_ = szValue; XtFree( szValue ); // nPrimersMaxLengthOfMononucleotideRepeat_ szValue = XmTextFieldGetString( widPrimersMaxLengthOfMononucleotideRepeat_ ); soValue = szValue; XtFree( szValue ); int nPerhapsPrimersMaxLengthOfMononucleotideRepeat; if (!bIsNumericMaybeWithWhitespace( soValue, nPerhapsPrimersMaxLengthOfMononucleotideRepeat ) ) { popupErrorMessage( "PrimersMaxLengthOfMononucleotideRepeat must be numeric" ); return; } consedParameters::pGetConsedParameters()->nPrimersMaxLengthOfMononucleotideRepeat_ = nPerhapsPrimersMaxLengthOfMononucleotideRepeat; delete this; }