NCBI C++ ToolKit
cn3d_threader.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: cn3d_threader.hpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * class to isolate and run the threader
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_THREADER__HPP
35 #define CN3D_THREADER__HPP
36 
37 #include <corelib/ncbistd.hpp>
38 #include <corelib/ncbistl.hpp>
39 
40 #include <map>
41 #include <list>
42 #include <vector>
43 
45 
46 #include "vector_math.hpp"
47 
48 
49 BEGIN_SCOPE(Cn3D)
50 
51 // for convenience, optional threading parameters are all specified in this block
53 {
54 public:
57  double weightPSSM;
62 
63  ThreaderOptions(void);
64 };
65 
67 
69 class Sequence;
70 class StructureBase;
71 class SequenceViewer;
72 class AlignmentManager;
73 
74 class Threader
75 {
76 public:
77  Threader(AlignmentManager *parentAlnMgr);
78  ~Threader(void);
79 
80  static const unsigned int SCALING_FACTOR;
82 
83  // create new BlockMultipleAlignments from the given multiple and master/dependent pairs; returns
84  // true if threading successful. If so, depending on options, nRowsAddedToMultiple will be
85  // merged into the multiple, and newAlignments will contain all un-merged master/dependent pairs
86  typedef std::list < BlockMultipleAlignment * > AlignmentList;
87  bool Realign(const ThreaderOptions& options, BlockMultipleAlignment *masterMultiple,
88  const AlignmentList *originalAlignments, AlignmentList *newAlignments,
89  unsigned int *nRowsAddedToMultiple, SequenceViewer *sequenceViewer);
90 
91  // calculate scores for each row in the alignment (and store them in the alignment itself)
92  bool CalculateScores(const BlockMultipleAlignment *multiple, double weightPSSM);
93 
94  // geometry violations - for each row of an alignment, get a list of seqIndex
95  // (from, to) pairs for offending regions; return total number of violations
96  typedef std::list < std::pair < unsigned int, unsigned int > > IntervalList;
97  typedef std::vector < IntervalList > GeometryViolationsForRow;
98  unsigned int GetGeometryViolations(const BlockMultipleAlignment *multiple,
100 
101  // estimate the number of random starts needed to thread an alignment based on
102  // the number of blocks to be aligned
103  static unsigned int EstimateNRandomStarts(const BlockMultipleAlignment *coreAlignment,
104  const BlockMultipleAlignment *toBeThreaded);
105 
106  // to hold virtual residue, sidechain positions
108  typedef struct {
109  unsigned char type;
111  int disulfideWith; // if Cysteine, virtual coord index of any disulfide-bound Cys; -1 otherwise
113  typedef std::vector < VirtualCoordinate > VirtualCoordinateList;
114 
115  // for (temporary) storage of contacts
116  typedef struct {
117  int
118  vc1, vc2, // virtual coord index
120  } Contact;
121  typedef std::list < Contact > ContactList;
122 
123 private:
125 
126  // holds Fld_Mtf structures already calculated for a given object (Molecule or Sequence)
127  typedef std::map < const StructureBase *, Fld_Mtf * > ContactMap;
129 
130  // threading structure setups
131  Cor_Def * CreateCorDef(const BlockMultipleAlignment *multiple, double loopLengthMultiplier);
132  Qry_Seq * CreateQrySeq(const BlockMultipleAlignment *multiple,
133  const BlockMultipleAlignment *pairwise, int terminalCutoff);
134  Rcx_Ptl * CreateRcxPtl(double weightContacts);
135  Gib_Scd * CreateGibScd(bool fast, unsigned int nRandomStarts);
136  Fld_Mtf * CreateFldMtf(const Sequence *masterSequence);
137  Seq_Mtf * CreateSeqMtf(const BlockMultipleAlignment *multiple, double weightPSSM);
138 };
139 
140 END_SCOPE(Cn3D)
141 
142 #endif // CN3D_THREADER__HPP
double loopLengthMultiplier
std::vector< VirtualCoordinate > VirtualCoordinateList
std::list< BlockMultipleAlignment * > AlignmentList
std::map< const StructureBase *, Fld_Mtf * > ContactMap
Cor_Def * CreateCorDef(const BlockMultipleAlignment *multiple, double loopLengthMultiplier)
ContactMap contacts
std::vector< IntervalList > GeometryViolationsForRow
bool Realign(const ThreaderOptions &options, BlockMultipleAlignment *masterMultiple, const AlignmentList *originalAlignments, AlignmentList *newAlignments, unsigned int *nRowsAddedToMultiple, SequenceViewer *sequenceViewer)
AlignmentManager * alignmentManager
Threader(AlignmentManager *parentAlnMgr)
static const unsigned int SCALING_FACTOR
std::list< std::pair< unsigned int, unsigned int > > IntervalList
static const std::string ThreaderResidues
unsigned int GetGeometryViolations(const BlockMultipleAlignment *multiple, GeometryViolationsForRow *violations)
~Threader(void)
Gib_Scd * CreateGibScd(bool fast, unsigned int nRandomStarts)
Seq_Mtf * CreateSeqMtf(const BlockMultipleAlignment *multiple, double weightPSSM)
Qry_Seq * CreateQrySeq(const BlockMultipleAlignment *multiple, const BlockMultipleAlignment *pairwise, int terminalCutoff)
static unsigned int EstimateNRandomStarts(const BlockMultipleAlignment *coreAlignment, const BlockMultipleAlignment *toBeThreaded)
bool CalculateScores(const BlockMultipleAlignment *multiple, double weightPSSM)
Fld_Mtf * CreateFldMtf(const Sequence *masterSequence)
Rcx_Ptl * CreateRcxPtl(double weightContacts)
std::list< Contact > ContactList
ThreaderOptions globalThreaderOptions
Include a standard set of the NCBI C++ Toolkit most basic headers.
string
Definition: cgiapp.hpp:687
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
The NCBI C++/STL use hints.
static Threader::GeometryViolationsForRow violations
Modified on Wed Apr 17 13:08:51 2024 by modify_doxy.py rev. 669887