/***************************************************************************** # 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 CONSENSUSTAG_INCLUDED #define CONSENSUSTAG_INCLUDED #include "rwcstring.h" #include using namespace std; #include #include "bool.h" #include "soEmptyString.h" #include // for Widget #include "rwtptrorderedvector.h" class Contig; class LocatedFragment; class guiPopupTagInfo; class userDefinedTagField; class userDefinedTagType; class gotoItem; static const RWCString soConsed = "consed"; const int nUndefinedTagID = -666; class tag { public: // for adding consed edit tags in locatedFragment.cpp by cons pos // Also, commentTag ctor uses this // editAddTagWithoutComment uses this tag( LocatedFragment* pLocFrag, Contig* pContig, const RWCString& soType, const int nConsPosStart, const int nConsPosEnd, const bool bWriteToPhdFileNotAceFile, const RWCString& soComment, //= soEmptyString, const RWCString& soSource, // = soConsed, const RWCString& soDate, // = soEmptyString, const bool bNoTrans ); // = false ); // this is so that when a tag pointer points to an oligoTag or commentTag, // the extra memory for the oligoTag/commentTag is also released virtual ~tag() {} // If there are two comment tags on the same location, overload this // operator by saying that the comments must be identical also // virtual RWBoolean operator==( const tag& ctag) const { // return( ( nPaddedConsPosStart_ == ctag.nPaddedConsPosStart_ ) && // ( nPaddedConsPosEnd_ == ctag.nPaddedConsPosEnd_ ) && // ( soType_ == ctag.soType_ ) && // ( soSource_ == ctag.soSource_ ) && // ( soDate_ == ctag.soDate_ ) ); } bool operator==( const tag& ctag ) const { return( this == &ctag ); } virtual bool operator<( const tag& tagg) const { if (nPaddedConsPosStart_ == tagg.nPaddedConsPosStart_ ) { if ( nPaddedConsPosEnd_ == tagg.nPaddedConsPosEnd_ ) { if ( soDate_ == tagg.soDate_ ) { if (soType_ == tagg.soType_ ) return( soSource_ < tagg.soSource_ ); else return( soType_ < tagg.soType_ ); } else return( soDate_ < tagg.soDate_ ); } else return( nPaddedConsPosEnd_ < tagg.nPaddedConsPosEnd_ ); } else return( nPaddedConsPosStart_ < tagg.nPaddedConsPosStart_ ); } // only used in the case of oligoTag and autoFinishExp virtual void flipOrientation() {} // write the basics here void writeTagToEditHistoryFile(); // only overridden in case of commentTag and oligoTag virtual void writeToEditHistoryFileAnythingSpecialForThisTagType() {} void writeDeleteTagToEditHistoryFile(); virtual void writeToEditHistoryFileAnythingSpecialForThisTagTypeForDeleteTag() {} bool bTagIsOnScreen( const int nScreenConsPosMin, const int nScreenConsPosMax, int& nVisibleConsPosMin, int& nVisibleConsPosMax ); bool bTouchesThisConsPos( const int nConsPos ) { return( ( nPaddedConsPosStart_ <= nConsPos ) && ( nConsPos <= nPaddedConsPosEnd_ ) ); } void popupTagInfoForOneTag( const int nNumberOfTagsAlreadyPoppedUp, void* pGuiContigWinOrGuiTeditor, const bool bIsGuiContigWin ); virtual bool bTagHasExtraInformation(); virtual void guiDisplayExtraInformation( Widget widForm, Widget widAbove, Widget widBelow, bool& bStuffAdded, Widget& widBottomOfExtraStuff ); void displayUserDefinedTagFields( Widget widForm, Widget widAbove2, Widget widBelow, Widget& widBottomOfExtraStuff ); virtual void askUserForExtraTagInformation( bool& bUserPushedCancel ); virtual RWCString soGetExtraInformationForNavigator(const int nMaxLength ); RWCString soGetBasicInformation(); bool bCheckTag( const int nPerhapsStartTagUnpaddedConsPos, const int nPerhapsEndTagUnpaddedConsPos ); void changeTag( const int nPerhapsStartTagUnpaddedConsPos, const int nPerhapsEndTagUnpaddedConsPos ); void changeTagComment( const RWCString& soComment ); virtual bool bCheckTagExtraInformation() { return true; } virtual void changeTagExtraInformation() {} void writeTagToPHDFile( ofstream& ofsPHD ); virtual void writeToPHDFileAnythingSpecialForThisTagType( ofstream& ofsPHD ); void adjustTagPosition(const int nAdjustToRightOfThisConsPos, const int nAmountToAdjust ); void complementSelf( ); // for use by pGetGuiColorTextForTag RWCString soGetTagType() { return( soType_ ); } void writeTagToAceFile( ofstream& ofsAceFile ); virtual void writeToAceFileAnythingSpecialForThisTagType( ofstream& ofsAceFile ); friend void cbMatchElsewhereTagSearchForString( Widget wid, XtPointer pClientData, XtPointer pCallData ); void matchElsewhereTagSearchForString(); // works even if the tag is a read tag Contig* pGetContig(); int nGetUnpaddedStart(); int nGetUnpaddedEnd(); void clearUserDefinedFields(); void writeUserDefinedTagTypeFields( ofstream& ofsAceFile ); void dealWithPointerFields( RWCString& soErrorMessage ); virtual gotoItem* pGetGotoItemForThisTag(); public: bool bReadTagNotConsensusTag_; LocatedFragment* pLocFrag_; Contig* pContig_; RWCString soType_; RWCString soSource_; bool bCoordinatesAreUnpaddedRead_; /* used for adding reads when can't convert unpadded to padded yet. These are not complemented--in direction of sequencing */ int nPaddedConsPosStart_; int nPaddedConsPosEnd_; RWCString soDate_; bool bWriteToPhdFileNotAceFile_; // this serves as a flag of whether the tag is already // popped up guiPopupTagInfo* pGuiPopupTagInfo_; bool bNoTrans_; // flag on consensus tags for // transferConsensusTags.perl to not transfer them RWCString soMiscData_; RWCString soComment_; long lID_; RWTPtrOrderedVector* pArrayOfUserDefinedTagFields_; userDefinedTagType* pUserDefinedTagType_; // only used for userDefinedTagType's }; void cbMatchElsewhereTagSearchForString( Widget wid, XtPointer pClientData, XtPointer pCallData ); #endif