00001 #ifndef OST_MOL_ALG_CONTACT_HH
00002 #define OST_MOL_ALG_CONTACT_HH
00003
00004 #include <boost/shared_ptr.hpp>
00005
00006 #include <ost/mol/entity_view.hh>
00007 #include <ost/img/image.hh>
00008 #include <ost/seq/alignment_handle.hh>
00009
00010
00011 #include "module_config.hh"
00012 #include "similarity_matrix.hh"
00013
00014 namespace ost { namespace mol { namespace alg {
00015
00016 struct Contact {
00017 Contact(): atom_a(), atom_b() {}
00018 Contact(ost::mol::AtomHandle a, ost::mol::AtomHandle b):
00019 atom_a(a), atom_b(b)
00020 { }
00021 ost::mol::AtomHandle atom_a;
00022 ost::mol::AtomHandle atom_b;
00023
00024 bool operator==(const Contact& rhs) const
00025 {
00026 return atom_a==rhs.atom_a && atom_b==rhs.atom_b;
00027 }
00028
00029 bool operator!=(const Contact& rhs) const
00030 {
00031 return !this->operator==(rhs);
00032 }
00033 };
00034
00035 typedef std::vector<Contact> ContactList;
00036
00038 ContactList DLLEXPORT_OST_MOL_ALG
00039 Contacts(const ost::mol::EntityView& ent, Real min_dist,
00040 Real max_dist);
00041
00042 typedef enum {
00043 OM_RELATIVE,
00044 OM_ABSOLUTE
00045 } OverlapMode;
00048 void DLLEXPORT_OST_MOL_ALG CalcContactNodeDegree(const ContactList& contacts);
00049
00050 struct LDT {
00051 Real ha;
00052 Real ma;
00053 Real la;
00054 };
00055
00056 class DistanceMatrix;
00057
00058 typedef boost::shared_ptr<DistanceMatrix> DistanceMatrixPtr;
00059
00060 class DLLEXPORT_OST_MOL_ALG DistanceMatrix: public ost::TriMatrix<Real> {
00061 public:
00062 static DistanceMatrixPtr Create(const ost::seq::ConstSequenceHandle& s);
00063 static DistanceMatrixPtr FromAln(const ost::seq::AlignmentHandle& a,
00064 int index=1);
00065 private:
00066 DistanceMatrix(const ost::seq::ConstSequenceHandle& sequence);
00067 DistanceMatrix(const ost::seq::AlignmentHandle& aln, int index);
00068
00069 };
00070
00071
00072 Real DLLEXPORT_OST_MOL_ALG ContactOverlap(const DistanceMatrixPtr& lhs,
00073 const DistanceMatrixPtr& rhs,
00074 Real tolerance,
00075 OverlapMode mode=OM_RELATIVE,
00076 Real dist_limit=1e6);
00077
00078
00079 Real DLLEXPORT_OST_MOL_ALG
00080 LocalDistanceTest(const ost::mol::EntityView& mdl,
00081 const ost::mol::EntityView& ref,
00082 Real max_dist,
00083 Real tolerance=0.02,
00084 bool only_complete=false);
00085
00086 SimilarityMatrix DLLEXPORT_OST_MOL_ALG
00087 ContactOverlapMap(const ost::seq::AlignmentHandle& target_tpl_aln,
00088 Real tolerance, int idx_a, int idx_b);
00089
00090 SimilarityMatrix DLLEXPORT_OST_MOL_ALG
00091 ContactOverlapMap(const ost::seq::AlignmentHandle& target_tpl_aln,
00092 Real tolerance, OverlapMode mode=OM_RELATIVE,
00093 Real max_dist=1e6);
00094
00095 SimilarityMatrix DLLEXPORT_OST_MOL_ALG
00096 ContactOverlapMap(const DistanceMatrix& dmat1, const DistanceMatrix& dmat2,
00097 Real tolerance, OverlapMode mode=OM_RELATIVE,
00098 Real max_dist=1e6);
00099
00100
00101
00102 void DLLEXPORT_OST_MOL_ALG
00103 DomainsFromCOM(const SimilarityMatrix& sim, ost::seq::AlignmentHandle aln,
00104 Real tolerance, int idx_a=-1, int idx_b=-1);
00105
00106 }}}
00107
00108 #endif