/***************************************************************************** # 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. # #*****************************************************************************/ // // contigview.h // // header file for the ContigView class // #ifndef CONTIGVIEW_INCLUDED #define CONTIGVIEW_INCLUDED #include "rwcstring.h" #include "ntide.h" #include "locatedFragment.h" #include "assert.h" #include "basesegment.h" #include "sequence.h" #include "rwtvalorderedvector.h" #include "rwtptrorderedvector.h" class ContigWin; typedef RWTValOrderedVector proteinTranslationArrayType; typedef RWTValOrderedVector proteinTranslationScreenCharXArrayType; // the contigview object describes a "window" on the contig. // for now it contains the range (start and end pos in putative // sequence) and an array of FragAttachments containing pointers // to only those fragments that intersect the window class ContigView { public: ContigView( Contig* pContig, const int nStart, const int nEnd); void operator=( const ContigView& contigView ); ContigView( const ContigView& contigView ); /* copy constructor */ // how many fragments appear in this view int nGetNumberOfFragments() const { return dapLocatedFragment_.length(); } // you can deference the contig view as an array to return a // const ref to the frag attachment at that pos in the list // ntMyNtide = coMyContig[nCurPos]; // L value version LocatedFragment* operator[] (int nIndex) { assert ((nIndex >= 0) && (nIndex < dapLocatedFragment_.length())); return dapLocatedFragment_[nIndex]; } LocatedFragment* pLocatedFragmentGet(const int nIndex) { assert ((nIndex >= 0) && (nIndex < dapLocatedFragment_.length())); return dapLocatedFragment_[nIndex]; } // add a located fragment to this view, but don't allow // access to the apLocatedFragment array directly void addLocatedFragment( LocatedFragment* plocfrag) { dapLocatedFragment_.insert( plocfrag ); } // set the size of the da of located frags void resize(const int nSize) { dapLocatedFragment_.resize(nSize); } // how many forward/reverse (i.e. comp/not comp) // frags in the view? int nForwardFrags() const { return nForFragsInView_; } int nReverseFrags() const { return nRevFragsInView_; } // increment counts of how many forward/reverse fragments // are in this view void incForFrags() { nForFragsInView_++; } void incRevFrags() { nRevFragsInView_++; } void sortReads(); void maybeSortReadsAtCursor( const int nConsPos ); void maybeSortReadsByQualityAtConsPos( const int nConsPos ); void sortReadsByQualityAtConsPos( const int nConsPos ); void sortReadsByBaseAtConsPos( const int nConsPos ); bool bIsSortedAlphabetically(); bool bIsSortedByStrandAndLeftEnd(); bool bIsSortedByFileOrder(); void tellPhrapNotToOverlapReadsDiscrepantAtThisLocation( const int nConsPosWhereToSplit, const bool bUsingGui, ContigWin* pContigWin ); void tryToHelpUserToTellPhrapToNotOverlapDiscrepantReads( const int nConsPosWhereToSplit, Widget widTopLevelShell ); int nWhatLineIsReadOn( LocatedFragment* pLocFrag ); RWCString soGetHowReadsAreSorted(); private: void sortReadsByFile(); public: enum { nWINDOW_SIZE = 5 }; // Note: These are not reliable, since the user can insert a column // of pads, and change the true nEndPos_. I believe the list of fragments // is reliable. (DG, 971124) int nStartPos_; // lower bound of view int nEndPos_; // upper bound of view // these get set when the view is created int nForFragsInView_; // number of forward frags in the ContigView int nRevFragsInView_; // number of reverse frags in the ContigView RWTPtrOrderedVector dapLocatedFragment_; // 0 is not used. Just 1 through 3 are the reading frames. proteinTranslationArrayType* pProteinTranslation_[4]; proteinTranslationScreenCharXArrayType* pProteinTranslationScreenCharX_[4]; int nSizeOfLargestReadPrefix_; // this is in no case larger than // pCP->nMaxCharsDisplayedForReadPrefix_ Contig* pContig_; enum { cQUALITY_AT_CURSOR = 'q', cSTRAND_AND_POSITION = 's', cALPHABETICALLY = 'a', cFILE = 'f', cUNKNOWN = 'u', cBASE_AT_CURSOR = 'b' }; char cHowAreReadsSorted_; int nConsPosOfSortWindow_; }; #endif