src/common/open_prospect.h

Go to the documentation of this file.
00001 /*
00002  *      This program is free software; you can redistribute it and/or modify
00003  *      it under the terms of the GNU General Public License as published by
00004  *      the Free Software Foundation; either version 2 of the License, or
00005  *      (at your option) any later version.
00006  *
00007  *      This program is distributed in the hope that it will be useful,
00008  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *      GNU General Public License for more details.
00011  *
00012  *      You should have received a copy of the GNU General Public License
00013  *      along with this program; if not, write to the Free Software
00014  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00015  */
00016 
00017 /***************************************************
00018  **
00019  **   open_prospect.h
00020  **        Feb 1st, 2004
00021  **    Kyle Ellrott
00022  **
00023  **
00024  **
00025  ***************************************************/
00026 
00029 #ifndef __open_prospect_h__
00030 #define __open_prospect_h__
00031 
00032 
00033 #include <stdlib.h>
00034 #include <math.h>
00035 #include <assert.h>
00036 
00037 #define TEMPLATELIST_DEFAULT        "default.list"  
00038 #define TEMPLATELIST_FSSP           "fssp.list"
00039 #define TEMPLATELIST_SCOP           "scop.list"
00040 #define FUNCTIONLIST                "function.list"
00041 #define SINGLETON_FILE              "singleton.param" 
00042 #define PAIRWISE_FILE               "pair.param" 
00043 #define ALIGNMENT_FILE              "alignment.dat"
00044 #define CONTACT_FILE            "contact_count.param"
00045 
00046 #define GONNETMATRIX_FILE           "gonnet.param"
00047 #define RESIDUELIB_FILE         "residues.lib"
00048 #define BBIND_FILE              "bbind02.May.lib"
00049 #define ATOMDATA_FILE           "atoms.dat"
00050 
00051 #define DEFIRE_CB_DATA              "dfire_cb.dat"
00052 #define DEFIRE_BIN_DATA             "dfire_bin_info.dat"
00053 
00054 #define WEIGHT_CONF_FILE        "weights.conf"
00055 
00056 
00057 //#define PairDistCutoff 49.0
00058 #define PairDistCutoff 58.0
00059 #define PairDistCutoffSqrt   7.61577310586
00060 #define MinDistTwoBody  4
00061 
00062 #define MaxContactCount 25
00063 
00064 #define StructTypeCount  3  
00065 #define ResidueTypeCount 20
00066 
00067 #define HELIX                  2
00068 #define SHEET                  1
00069 #define LOOP                   0
00070 
00071 
00072 
00073 extern char pdb_atomname[288][4];
00074 
00075 
00077 #define pValType float
00078 
00079 
00080 //#define vGapOpen    10.8
00081 //#define vGapExtend  0.6
00082 
00083 #define e_mutation       0
00084 #define e_mutationfull   1
00085 #define e_mutationlog    2
00086 #define e_mutscore       3
00087 #define e_singleton      4
00088 #define e_sec_struct     5
00089 #define e_twobody_frozen 6
00090 #define e_twobody        7
00091 #define e_distconst      8
00092 #define e_dfire          9
00093 #define e_contact        10
00094 #define e_gapopen        11
00095 #define e_gapconst       12
00096 #define e_coredel        13
00097 #define e_tsingledel     14
00098 #define e_tsingleins     15
00099 #define e_qsingledel     16
00100 #define e_qsingleins     17
00101 #define e_contactdel     18
00102 #define e_count          19
00103 
00104 #define e_mask(x)         ((0x00000001) << (x))
00105 
00106 #define et_gap            0
00107 #define et_single         1
00108 #define et_pair           2
00109 
00110 
00111 #ifdef energy_global_define
00112 char e_names[e_count][40] = {
00113         "mutation",
00114         "mutationfull",
00115         "mutationlog",
00116         "mutscore",
00117         "singleton",
00118         "sec_struct",
00119         "twobody_frozen",
00120         "twobody",
00121         "distconst",
00122         "dfire",
00123         "contact",
00124         "gapopen",
00125         "gapconst",
00126         "coredel",
00127         "tsingledel",
00128         "tsingleins",
00129         "qsingledel",
00130         "qsingleins",
00131         "contactdel"
00132 };
00133 char e_types[ e_count ] = {
00134         et_single,
00135         et_single,
00136         et_single,
00137         et_single,
00138         et_single,
00139         et_single,
00140         et_single,
00141         et_pair,
00142         et_pair,
00143         et_pair,
00144         et_single,
00145         et_gap,
00146         et_gap,
00147         et_gap,
00148         et_gap,
00149         et_gap,
00150         et_gap,
00151         et_gap
00152 };
00153         
00154 #else
00155 extern char e_names[e_count][40];
00156 extern char e_types[e_count];
00157 #endif
00158 
00159 
00160 #if 1
00161 typedef pValType EnergyArray[e_count];
00162 #else
00163 class EnergyArray {
00164 public:
00165         pValType& operator[](int x) {
00166                 return value[x];
00167         }
00168 //private:
00169         pValType value[e_count];
00170 };
00171 #endif
00172 
00173 typedef pValType WeightArray[e_count];
00174 
00175 
00177 
00178 #define f_count  13
00179 
00180 class AlignFeatures {
00181 public:
00182         AlignFeatures(void);
00183         enum {
00184                 //actual numeric values
00185                 fn_align,
00186                 fn_ident,
00187                 fn_contact,
00188                 fn_halfcontact,
00189                 fn_align_pair,
00190                 fn_align_core, 
00191                 fn_align_core_res,              
00193                 fr_align,
00194                 fr_ident,
00195                 fr_contact,
00196                 fr_halfcontact,
00197                 fr_align_pair,
00198                 fr_surface
00199         };      
00200         void CalcFeatures( class TemplateStruct *template_data, class TargetStruct *taget_data,  class AlignmentStruct *align );                
00201         pValType Get(unsigned int i) {
00202                 return feature[i];
00203         }
00204         static char *GetName(unsigned int i);   
00205         char IsSet(unsigned int i) {
00206                 return is_set[i];
00207         }
00208         void Set(unsigned int i, pValType val) {
00209                 feature[ i ] = val;
00210                 is_set[i] = 1;
00211         }
00212         static int Count(void) { return f_count; };
00213 private:
00214         pValType feature[ f_count ];
00215         char is_set[ f_count ];
00216 };
00217 
00218 
00219 
00221 
00222 
00223 #ifndef VEC3_DEFINED
00224 #define VEC3_DEFINED
00225 typedef float vec3[3];
00226 typedef float mat3[3][3];
00227 #endif
00228 
00229 
00230 #define anN    0
00231 #define anCa   1
00232 #define anC    2
00233 #define anO    3
00234 #define anBBcount 4
00235 #define anCb   4
00236 
00237 #define kMaxResAtoms   24
00238 
00239 class ResidueAtoms {
00240 public: 
00241         ResidueAtoms()  { atom_count = 0;  chain = ' '; res_num = 0; bb_num[0] = bb_num[1] = bb_num[2] = bb_num[3] = bb_num[4] = -1; }
00242         void GetBBLoc( int n, vec3 loc ) {
00243                 if ( bb_num[n] != -1 ) {
00244                         for ( int i = 0; i < 3; i++ )
00245                                 loc[i] = atom[ bb_num[ n ] ][i];
00246                 }
00247         }
00248         int GetAtomIndex( int atom_name );
00249         void SetAtomLoc( int atom_name, vec3 loc);
00250         void SetTempFactor( int atom_index, float new_temp);
00251         void ReadAtomLine( char * line );
00252         char *WriteAtomLine(int i, char RS = 'X', int res_num = 0, char chain = ' ');
00253         vec3          atom[kMaxResAtoms];
00254         int           atom_name[kMaxResAtoms];
00255         int           atom_num[kMaxResAtoms];
00256         int           bb_num[anBBcount + 1];
00257         pValType      radius[kMaxResAtoms];
00258         pValType      temp_factor[kMaxResAtoms];
00259         vec3          Cm;
00260         int           atom_count;
00261         
00262         int           res_num;
00263         char          res_mod;
00264         char          chain;
00265 };
00266 
00267 int ResidueAtoms_CalcCb(ResidueAtoms *res);
00268 pValType calc_LRET(vec3 a, vec3 b, pValType ra, pValType rb);
00269 
00271 typedef struct TemplateResidue {
00272   long Score[21];
00273   int core_num;                                 
00274   int NUM;                                      
00275   int ACC;                                      //< Solvent Accesbity catagory
00276   
00277   //this info is replicated in the TargetResidue
00278   //  pValType PROFILE[21];                             ///< Amino Acid profile information
00279   //  char RS;                                  //< Amino acid letter
00280   //  char SS;                                  //< Secondary structure definition
00281   //  pValType phi,psi;                         //< Phi,Psi values
00282   //  ResidueAtoms structure;  
00283 } TemplateResidue;
00284 
00285 //#define rsUndefined  0
00286 //#define rsBackBone   1
00287 //#define rsSideChain  2
00288 
00290 class TargetResidue {
00291 public: 
00292         TargetResidue() {
00293                 chain = ' ';
00294                 RS = 'X';
00295                 SS = 'L';
00296                 //structure_state = rsUndefined;
00297                 orig_num = 0;
00298                 single_del = 1.0;
00299                 single_ins = 1.0;
00300         };
00301         
00302         pValType FREQ[21];    //< The frequency profile of this residue
00303         pValType SS_PROB[3];  //< Probability of different secondary structures
00304         pValType single_del, single_ins;
00305 
00306         char RS;                
00307         char SS;                
00308         int  orig_num;   
00309 //      ResidueAtoms structure;
00310 //      char  structure_state;  ///< to what level has the  atomic positions been defined, see the rs... #define values
00311         pValType phi, psi;
00312         char     chain;
00313 } ;
00314 
00315 
00316 
00317 
00319 typedef struct {
00320   int member_count;
00321   int core_number[4];
00322   int residue_number[4];
00323   int core_flag;
00324 } InteractionElement;
00325 
00327 typedef struct {
00328   int head;
00329 //  int tail;
00330   int len;
00331 } TemplateCoreDefinition;
00332 
00333 
00334 
00335 
00336 
00339 typedef struct DfireStruct {
00340         int bin_count, dist_hash_size;
00341         pValType *bin_min, *bin_max, dist_max;
00342         short *dist_hash;
00343         pValType ***bin;
00344 } DfireStruct;
00345 
00346 
00347 
00348 //the following data structures outline the standard interface for threading functions
00349 
00363 typedef char *(*threading_function)(struct ProspectParam *, 
00364                                                                         WeightArray,
00365                                                                         struct TemplateStruct *, 
00366                                                                         struct TargetStruct *,
00367                                                                         struct AlignmentStruct *);
00368 
00370 typedef char *(*scoring_function)(ProspectParam *, 
00371                                                                   WeightArray, 
00372                                                                   TemplateStruct *,
00373                                                                   TargetStruct *,
00374                                                                   AlignmentStruct *);
00375 
00376 class ParamElement {
00377 public:
00378         ParamElement( ProspectParam *in_parent) { parent = in_parent; };
00379         virtual ~ParamElement(void) { FreeMem(); };
00380         virtual void FreeMem(void) { } ;
00381 protected:
00382         class ProspectParam *parent;
00383 };
00384 
00385 
00386 
00387 
00391 typedef struct ResidueInfoElement {
00392         char RS;          
00393         ResidueAtoms   structure;
00394         int torsion_count; 
00395         pValType *torsion_val;  
00396         char **torsion_mask; 
00397         char *torsion_a;
00398         char *torsion_b;
00399 } ResidueInfoElement;
00400 
00401 
00402 
00403 typedef struct AtomDataElement {
00404         char name[4];
00405         pValType radius;
00406 } AtomDataElement;
00407 
00408 
00409 class AtomData : public ParamElement {
00410 public:
00411         AtomData( ProspectParam *in_parent);    
00412         pValType FindRadius( char *name );      
00413         pValType FindRadius( int num ); 
00414         AtomDataElement *atoms; 
00415         int atom_data_count;
00416 };
00417         
00418 typedef struct PopsParamsElement {
00419         int atom_num, rs_num;
00420         float radius, p_i;
00421 };
00422 
00423 class PopsParam : public ParamElement {
00424 public: 
00425         PopsParam(ProspectParam *in_parent);            
00426         int LoadParam(char *path);      
00427         PopsParamsElement *params;
00428         int param_count;
00429         float b_ij, p_j, p_14, p_gt14;  
00430 };
00431 
00432 
00433 
00435 typedef struct {
00436         float prob;             
00437         pValType  chi[4];       
00438         int phi,psi;
00439 } RotamerElement;
00440 
00442 typedef struct RotamerArray {
00443         char RS;      
00444                                   //    int chi_count;  ///< number of chi angles stored in each rotamer element
00445         int rotamer_count;
00446         RotamerElement *rotamer;
00447         int phi_bin, psi_bin;
00448 } RotamerArray;
00449 
00450 
00451 
00454 class ProspectParam{
00455 public: 
00456         ProspectParam(char *base_path = NULL);
00457         ~ProspectParam();
00458         
00459         int Init(void);
00460         
00461         //int InitAtomData(void);
00462         
00464         int InitRotamer(void);
00465 
00466         int InitPops(void);
00467         
00468         PopsParam* GetPopsParam(void);
00469         PopsParam* GetPopsRParam(void); 
00470 
00475         char ** Template_Paths(void);   
00476         
00481         char * TemplateFind(char *template_name);
00482         
00483         //Methods for dynamic function/datastructure search
00484         
00489         threading_function ThreaderFind(char *request_name);    
00490         
00491         int Weight_Find(char *request_name, WeightArray weights);
00492         
00501         int DoThreading(
00502                                         char *threader_name,
00503                                         WeightArray weight,              
00504                                         TemplateStruct *template_data,
00505                                         TargetStruct *target_data,
00506                                         AlignmentStruct *alignment,
00507                                         struct ScoreStruct *scores ) ;
00508         
00509         
00510         int DoThreading(
00511                                         threading_function threader,
00512                                         WeightArray weight,              
00513                                         TemplateStruct *template_data,
00514                                         TargetStruct *target_data,
00515                                         AlignmentStruct *alignment,
00516                                         struct ScoreStruct *scores ) ;
00517         
00518         
00519         
00520         void CopyGonnetMatrix( class TemplateStruct *template_data );
00521         
00522         
00523         //path information      
00524         char *ProspectPath;
00525         char **template_paths;
00526         
00527         //Parameter tables for  threading, loaded by Init()
00528         pValType **PAIR_POT;
00529         pValType SINGLETON[21][9];
00530         char ALIGN_MATRIX[21][21];
00531         pValType  GONNET_MATRIX[21][21];
00532         pValType  CONTACT_MATRIX[21][MaxContactCount];
00533         DfireStruct dfire;
00534         
00535         //Optional Parameter Elements 
00536         
00537         //Residue info
00538         ResidueInfoElement *residue_info;
00539         RotamerArray *rotamer_array;
00540         AtomData *atom_data;
00541         int atom_data_count;
00542         
00543         //The Pops based SASA calculation parameters, one for all atom, one for residue based calculations
00544         PopsParam *pops_param, *pops_r_param;
00545         
00546         //User Alterable variables
00547         char output_weights, output_timeinfo, output_template_loc, output_pdb, output_backbone, simple_twobody;
00548         unsigned char ncpus;
00549         long max_bytes;
00550         int z_cycles;
00551         char filter, no_loop, second_guess, full_twobody;
00552         char v_level; //how verbose?
00553 };
00554 
00555 
00556 
00557 
00558 
00559 class ScoreStruct {
00560 public: 
00561         
00562         enum {
00563                 SCORE_RAW           = 0,
00564                 SCORE_Z             = 1,
00565                 SCORE_ZFULL         = 2,
00566                 SCORE_NN            = 3,
00567                 SCORE_USER0         = 4,
00568                 SCORE_USER1         = 5,
00569                 SCORE_USER2         = 6,
00570                 SCORE_USER3         = 7,
00571                 SCORE_ZMUTATIONLOG  = 8,
00572                 SCORE_ZSINGLETON    = 9,
00573                 SCORE_ZSEC_STRUCT   = 10,
00574                 SCORE_ZTWOBODY      = 11,
00575                 SCORE_ZDFIRE        = 12,
00576                 
00577                 SCORE_COUNT         = 8,
00578                 SCORE_COUNT_TOTAL   = 13,
00579                 
00580                 SCORE_ZENERGY_START = 8,
00581                 SCORE_ZENERGY_END   = 13,
00582                 
00583                 DO_SCORE_RAW         = 0x01,
00584                 DO_SCORE_Z           = 0x02,
00585                 DO_SCORE_ZFULL       = 0x04,
00586                 DO_SCORE_ZENERGY     = 0x10,
00587         };
00588         
00589         
00590         ScoreStruct(void);
00591         ~ScoreStruct(void);
00592         
00593         pValType ScoreRaw(
00594                                   ProspectParam *param,
00595                                   WeightArray weight,            
00596                                   TemplateStruct *template_data,
00597                                   TargetStruct *target_data, 
00598                                   AlignmentStruct *alignment);
00599         
00600         pValType ScoreZ(
00601                                 ProspectParam *param,
00602                                 WeightArray weight,              
00603                                 TemplateStruct *template_data, 
00604                                 TargetStruct *target_data,
00605                                 AlignmentStruct *alignment_whole);
00606         
00607         pValType ScoreZFull(
00608                                         ProspectParam *param,
00609                                         WeightArray weight,              
00610                                         TemplateStruct *template_data, 
00611                                         TargetStruct *target_data,
00612                                         AlignmentStruct *alignment_whole);
00613         
00614         void SetScore( int i,  pValType val ) { mask |= (0x00000001 << i); values[i] = val; }
00615 
00616         pValType GetScore( int i ) { return  values[i]; }
00617         
00618         static char *GetScoreName(int num);
00619         
00620         int mask;
00621         pValType  values[ SCORE_COUNT_TOTAL ];          
00622         pValType  z_sd[ SCORE_COUNT_TOTAL ], z_mean[ SCORE_COUNT_TOTAL ];       
00623 };
00624 
00625 
00626 typedef struct TargetDistConstraint {
00627         int aa[2];
00628         pValType dist;
00629         pValType var;
00630 } TargetDistConstraint;
00631 
00632 
00636 class TargetStruct {
00637 public:
00638         TargetStruct(void);     
00643         virtual ~TargetStruct();        
00644         
00645         virtual void SetLen(int new_len);
00646         void FreeMem(void);     
00647         
00648         TargetStruct(const TargetStruct &rhs);
00649         
00656         int Setup(ProspectParam *param);        
00661         int LoadConstraint(char *constraint_file);
00662         int LoadPsiPred(char *psipred_path);
00663         int LoadFasta(char *SeqPath);
00664         int LoadPHD(char *filename);
00665         int LoadChk(char *ChkPath);
00666         int LoadFreq(char *FreqPath);
00667         int LoadPDB(char *filename, char chain=0);
00668         int SetSequence(char *seq);
00675         int Copy(TargetStruct *template_data, int start = -1, int stop = -1);
00676         int Append(TargetStruct *rhs, int start = -1, int stop = -1);
00681         int LoadSSP( char *ssp_path);
00682         
00683         
00684         int LoadSSPStr(char *ssp_text);
00685                 
00686         void ReadSingleDelStr( char *text );
00687         void ReadSingleInsStr( char *text );
00688 
00689         
00690         int LoadXML( char *xml_path);
00695         /*
00696          int StructureSet(ProspectParam *param, 
00697                                           TemplateStruct *template_data, 
00698                                           AlignmentStruct *align_data, 
00699                                           int *rotamer_selection );
00700          */
00705         int CopyBackBone( TemplateStruct *template_data,
00706                                           AlignmentStruct *align_data,
00707                                           int start = -1, int stop = -1);
00708         
00709         pValType Calc_LRET(ProspectParam *param);
00710         //pValType Prospect_calc_LRET(vec3 a, vec3 b, pValType ra, pValType rb);
00711         int Count_Atoms(void);
00712         
00713         void ReNumberAtoms(int start = 0);
00714         
00715         int Count_SetResidues(void);
00716         int Count_UnSetResidues(void);
00717         
00718         vec3 *GetCaLocArray(void);
00719         
00723         void SetChain(char new_chain = ' ');
00724         
00727         int DSSP(void);
00728         
00729         void Calc_hloc(int residue, vec3 h_loc);
00730         float Calc_hval(int i, int j);
00731         void Setup_Hbonds( void );
00732         
00733         void CleanUndefinedResidues(void);
00734         
00736         void ChouFasman(void);
00740         //char* Prospect_Target_TextPDB(TargetStruct *target_data);
00741         int WritePDB(char *outpath = NULL, int start=-1, int stop=-1);
00742         char * WritePDBText(int start=-1, int stop=-1);
00743         
00744         char *GetSeq(void);
00745         
00746         int FindResIndexFromResNum( int res_num, char res_mod = ' ' );
00747         
00751         int SideChain_Init(ProspectParam *param);       
00752         int SideChain_Pack(ProspectParam *param);
00753         
00754         
00755         void MoveMeanToOrigin(void);
00756         
00757         TargetResidue *GetResidue(int i) {
00758                 if ( i < len )
00759                         return &residue[i];
00760                 else
00761                         return NULL;
00762         }
00763         ResidueAtoms *GetResidueAtoms(int i) {
00764                 if ( i < len )
00765                         return &structure[i];
00766                 else
00767                         return NULL;
00768         }
00769         
00770         
00771         pValType GetTwobody(int i, int j) {
00772                 if ( i < len && j < len ) 
00773                         return twobody[i][j];
00774                 else
00775                         return 10000;
00776         }
00777         
00778         char GetBSheet(int i, int j) {
00779                 if (bsheet != NULL &&
00780                         i >= 0 && i < len &&
00781                         j >= 0 && j < len ) 
00782                         return bsheet[i][j];
00783                 return 0;
00784         }
00785         
00786         void Translate(vec3 trans);
00787         void Rotate (mat3 rotate);      
00788         int GetCaCount(void);
00789         vec3 *GetCaArray(void);
00790         
00791         int len, residue_offset;             
00792         pValType **twobody;  
00793         pValType **hbond;
00794         char **bsheet;
00795         TargetDistConstraint  *distconst;
00796         int distconst_count;
00797         TargetResidue *residue; 
00798         ResidueAtoms *structure;
00799 };
00800 
00801 
00803 class TemplateStruct : public TargetStruct {
00804 public:
00805         
00806         TemplateStruct();
00807         ~TemplateStruct();
00808         
00809         void FreeMem(void);
00810         
00814         int LoadFile( char *template_path );                       
00815         
00816         void SetLen(int new_len);
00817         
00818 
00819         TemplateCoreDefinition *get_core( int i ) {
00820                 if ( i < core_count ) 
00821                         return &cores[i];
00822                 else 
00823                         return NULL;
00824         }
00825         
00826         int SetSequence(char *seq);
00827         
00828         void CopyScoreTable( pValType **score_matrix );
00829         void CopyScoreTable( pValType score_matrix[21][21] );
00830 
00831   TemplateResidue *t_residue_info;
00832   char *template_name;
00833   char pdbcode[5];
00834   char pdbchain;
00835   int start_res, stop_res;
00836   char start_icode, stop_icode;
00837   //  int interaction_count;
00838   //  InteractionElement *interactions;
00839   int twobody_count;
00840   InteractionElement *twobody_interactions;
00841   int threebody_count;
00842   InteractionElement *threebody_interactions;
00843   int fourbody_count;
00844   InteractionElement *fourbody_interactions;
00845   int core_count;
00846   TemplateCoreDefinition *cores;
00847   pValType  **cb_dist;
00848 };
00849 
00850 
00851 
00852 
00853 
00854 
00861 class AlignmentStruct {
00862 public:
00863         AlignmentStruct();
00864         ~AlignmentStruct();
00865         
00866         AlignmentStruct & operator=(const AlignmentStruct &rhs);        
00867         AlignmentStruct(const AlignmentStruct &rhs);    
00868         
00869         void Free(void);
00870         void Copy(const AlignmentStruct &rhs);  
00871         
00872         void SetAlign( int in_target_len, int *in_target_align, int in_template_len, int *in_template_align) {
00873                 target_len = in_target_len;
00874                 target_align = in_target_align;
00875                 template_len = in_template_len;
00876                 template_align = in_template_align;     
00877         }
00878         
00879         int SetAlign( char *target_align, char *template_align );
00880         int SetAlign( AlignmentStruct &rhs, int target_start = -1, int target_end = -1);
00881         int SetAlign( ProspectParam *param,
00882                                   WeightArray weights,
00883                                   TemplateStruct *template_data, 
00884                                   TargetStruct *target_data, 
00885                                   int *core_pos, char *core_del = NULL );
00886         int SetAlignFromNumStr( char *target_align, char *template_align );
00887 
00888         char * Write_XML(ProspectParam *param,
00889                                          WeightArray weight,    
00890                                          TemplateStruct *template_data,
00891                                          TargetStruct *target_data, 
00892                                          ScoreStruct *score);
00893         
00901         void GetEnergies( ProspectParam *param, 
00902                                           TemplateStruct *template_data, TargetStruct *target_data,
00903                                           EnergyArray energy, long mask = 0xFFFFFFFF);
00904 
00905         int GetFragCount(void);
00906         int GetFragStart(int frag_num);
00907         int GetFragStop(int frag_num);
00908         void CalcFrag(void);
00909         
00910         int GetTargetAlign(int i) {
00911                 if (i >= 0 && i < target_len)
00912                         return target_align[i];
00913                 return -1;
00914         }
00915         int GetTemplateAlign(int i) {
00916                 if (i >= 0 && i < template_len)
00917                         return template_align[i];
00918                 return -1;
00919         }
00920         int GetTargetLen(void) { return target_len; }
00921         int GetTemplateLen(void) { return template_len; }
00922         char *GetTargetAlignStr(TemplateStruct *template_data, TargetStruct *target_data);
00923         char *GetTemplateAlignStr(TemplateStruct *template_data, TargetStruct *target_data);    
00924         void GetAlignmentStrings( ProspectParam *param, 
00925                                                  TemplateStruct *template_data,
00926                                                  TargetStruct *target_data,
00927                                                  char** template_str, char** template_ss_str,
00928                                                  char** target_str, char** target_ss_str,
00929                                                  char** align_str, char** core_str);
00930         
00931         
00932         char    method[ 20 ];   
00933         friend class ProspectOutput;
00934         friend class ProspectThreadingInfo;
00935 protected:
00936         int    *target_align;
00937         int    *template_align;
00938         int     target_len;
00939         int     template_len;
00940         int *frag_start;
00941         int *frag_stop;         
00942         int frag_count;
00943         friend class TargetAlignmentStruct;
00944 };
00945 
00946 
00947 
00948 
00949 class TargetAlignmentStruct {
00950 public:
00951         TargetAlignmentStruct();
00952         ~TargetAlignmentStruct();
00953         TargetAlignmentStruct(const TargetAlignmentStruct &rhs);
00954         
00955         TargetAlignmentStruct(const AlignmentStruct &rhs);
00956 
00957         void SetAlign(TargetStruct *target_1_in, int *target_1_align_in, TargetStruct *target_2_in, int *target_2_align_in);
00958         void SetAlign(TargetStruct *target_1_in, int target_1_offset, TargetStruct *target_2_in, int target_2_offset, int len);
00959         char SetAlign(const char *target1, const char *target2);
00960         
00961         void SetAlign(int *target_1, int *target_2, int len_both);
00962         void SetAlign(int *target_1, int len_1, int *target_2, int len_2);
00963 
00964         
00966         char LoadFast(char *fast_file);
00967         
00969         void ClearAlign(void);
00970         
00972         void ModAlign(int target_1_offset, int target_2_offset, int len);
00973         
00974         char MergeAlign( TargetAlignmentStruct *align_1, TargetAlignmentStruct *align_2);
00975         
00978         char CheckAlign(void);
00979         
00980         pValType GetCaRmsd(TargetStruct *target_1, TargetStruct *target_2);
00981         pValType Get1to2Trans(TargetStruct *target_1, TargetStruct *target_2, vec3 trans1, mat3 rot, vec3 trans2 );
00982         pValType Get2to1Trans(TargetStruct *target_1, TargetStruct *target_2, vec3 trans1, mat3 rot, vec3 trans2 );
00983         
00984         void Move1to2( TargetStruct *target_1, TargetStruct *target_2 );
00985         void Move2to1( TargetStruct *target_1, TargetStruct *target_2 );
00986         
00987         void Move1to2( vec3 *target_1, vec3 *target_2 );        
00988         
00989         pValType AlignTargetCa(TargetStruct *target_1, TargetStruct *target_2, 
00990                                                    int *target_1_align, int *target_2_align,
00991                                                    vec3 trans1, mat3 rot, vec3 trans2);
00992         pValType AlignVec3( vec3 *target_1, vec3 *target_2, vec3 trans1, mat3 rot, vec3 trans2);
00993         
00994         void ApplyAlignTrans( TargetStruct *target, vec3 trans1, mat3 rot, vec3 trans2);
00995         void ApplyAlignTrans( ResidueAtoms *target, int target_len, vec3 trans1, mat3 rot, vec3 trans2);
00996         void ApplyAlignTrans( vec3 *target, int target_len, vec3 trans1, mat3 rot, vec3 trans2);
00997         
00998         int GetTarget1Align(int i) {
00999                 if (i >= 0 && i < target_1_len)
01000                         return target_1_align[i];
01001                 return -1;
01002         }
01003         int GetTarget2Align(int i) {
01004                 if (i >= 0 && i < target_2_len)
01005                         return target_2_align[i];
01006                 return -1;
01007         }
01008 private:
01009         int *target_1_align, *target_2_align, target_1_len, target_2_len;       
01010 };
01011 
01012 
01013 
01014 
01015 
01017 typedef struct ThreaderDesc {
01018   char name[255];
01019   char parallel;       
01020   char pair_optimize;  
01021   threading_function  function_call;
01022 } ThreaderDesc;
01023 
01024 
01025 
01029 int Prospect_Target_Rotamer(ProspectParam *param, ResidueAtoms *structure, char residue, int rotamer_number);
01030 
01031 
01032 /*
01033 class ProteinLinearAtoms {
01034 public:
01035         ProteinLinearAtoms(void) { 
01036                 atom_count = 0; atom_loc = NULL; residue_num = NULL; 
01037                 atom_type = NULL; temp_factor = NULL;
01038         };
01039         ~ProteinLinearAtoms(){
01040                 if (atom_loc != NULL) free(atom_loc);
01041                 if (residue_num != NULL) free(residue_num);
01042                 if (atom_type != NULL) free(atom_type);
01043                 if (temp_factor != NULL) free(temp_factor);
01044         }
01045         ProteinLinearAtoms( ResidueAtoms *r_atoms, int count ) {
01046                 extract_residueatom_array( r_atoms, count );
01047         }
01048         
01049         void extract_target( TargetStruct *target );
01050         void extract_residueatom_array( ResidueAtoms *r_atoms, int count);
01051         
01052         int atom_count;
01053         vec3 *atom_loc;
01054         int *residue_num;
01055         int *atom_type;
01056         float *temp_factor;
01057 };
01058 */
01059 
01060 
01061 typedef struct RotamerMask {
01062         long len;
01063         char **state;
01064         ResidueAtoms **structure;
01065         pValType **single_score;
01066         pValType ***pair_score;
01067         long **rot_num;
01068         long *count;
01069 } RotamerMask;
01070 
01071 
01072 pValType rot_mask_pairscore_get( RotamerMask *mask, long vertex_1, long vertex_2, long state_1, long state_2);
01073 void rot_mask_pairscore_set( RotamerMask *mask, long vertex_1, long vertex_2, long state_1, long state_2, pValType score);
01074 
01075 int Prospect_Target_RotamerMask_Init(ProspectParam *param, TargetStruct *target_data, RotamerMask *rotamer_mask);
01076 void Prospect_Target_RotamerMask_Free(RotamerMask *mask);
01077 int Prospect_RotamerMask_DEE(RotamerMask *mask);
01078 int Prospect_RotamerMask_DEE_Split(RotamerMask *mask);
01079 int Prospect_RotamerMask_TreeDecomp( RotamerMask *mask );
01080 
01081 
01082 pValType calc_raw_score( WeightArray weights, EnergyArray energies );
01083 
01084 
01094 pValType calc_single_energy(ProspectParam *param,
01095                                                         WeightArray weights,
01096                                                         TemplateStruct *template_data,
01097                                                         TargetStruct *target_data,
01098                                                         int template_res_num,
01099                                                         int target_res_num);
01100 
01101 
01113 pValType calc_pair_energy(ProspectParam *param,
01114                                                   WeightArray weights,
01115                                                   TemplateStruct *template_data,
01116                                                   TargetStruct *target_data,
01117                                                   int template_res_num_1, int template_res_num_2,
01118                                                   int target_res_num_1, int target_res_num_2);
01119 
01120 
01121 pValType calc_del_val(ProspectParam *param,
01122                                           WeightArray weights,
01123                                           TemplateStruct *template_data,
01124                                           TargetStruct *target_data,
01125                                           int template_res_num, int target_res_num );
01126 
01127 
01128 
01129 pValType calc_ins_val( ProspectParam *param,
01130                                            WeightArray weights,
01131                                            TemplateStruct *template_data,
01132                                            TargetStruct *target_data,
01133                                            int template_res_num, int target_res_num );
01134 
01135 pValType calc_coredel(ProspectParam *param,
01136                                           TemplateStruct *template_data,
01137                                           int template_res_num);
01138 
01139 
01140 pValType calc_contactdel(ProspectParam *param,
01141                                                   TemplateStruct *template_data,
01142                                                   int template_res_num);
01143 
01154 /*
01155 void calc_core_single_energies(ProspectParam *param,
01156                                TemplateStruct *template_data,
01157                                TargetStruct *target_data,
01158                                long core, long core_pos, pValType *energies);
01159 */
01160 
01169 pValType calc_mutation(ProspectParam *param,
01170                      TemplateStruct *template_data,
01171                      TargetStruct *target_data,
01172                      int template_res_num,
01173                      int target_res_num);
01174 
01175 
01176 pValType calc_mutationlog(ProspectParam *param,
01177                      TemplateStruct *template_data,
01178                      TargetStruct *target_data,
01179                      int template_res_num,
01180                      int target_res_num);
01181 
01182 
01183 pValType calc_mutationfull(ProspectParam *param,
01184                                                         TemplateStruct *template_data,
01185                                                         TargetStruct *target_data,
01186                                                         int template_res_num,
01187                                                         int target_res_num);
01188 
01197 pValType calc_sec_struct(ProspectParam *param,
01198                        TemplateStruct *template_data,
01199                        TargetStruct *target_data,
01200                        int template_res_num,
01201                        int target_res_num);
01202 
01211 pValType calc_singleton(ProspectParam *param,
01212                       TemplateStruct *template_data,
01213                       TargetStruct *target_data,
01214                       int template_res_num,
01215                       int target_res_num);
01216 
01225 pValType calc_mutscore(ProspectParam *param,
01226                                            TemplateStruct *template_data,
01227                                            TargetStruct *target_data,
01228                                            int template_res_num,
01229                                            int target_res_num);
01230                      
01231                      
01241 pValType calc_twobody_frozen(ProspectParam *param,
01242                                  TemplateStruct *template_data,
01243                                  TargetStruct *target_data,
01244                                  int template_res_num,
01245                                  int target_res_num);
01246 
01247 
01248 
01249 
01250 pValType calc_contact_frozen(ProspectParam *param,
01251                                                          TemplateStruct *template_data,
01252                                                          TargetStruct *target_data,
01253                                                          int template_res_num,
01254                                                          int target_res_num);
01255 
01256 
01269 pValType calc_twobody(ProspectParam *param,
01270                     TemplateStruct *template_data,
01271                     TargetStruct *target_data,
01272                     int template_res_num_1, int template_res_num_2,
01273                     int target_res_num_1, int target_res_num_2);
01274 
01275 
01276 pValType calc_twobody_val(ProspectParam *param,
01277                     TargetStruct *target_data,
01278                     int template_res_num_1, int template_res_num_2);
01279 
01290 pValType calc_dfire(ProspectParam *param,
01291                      TemplateStruct *template_data,
01292                      TargetStruct *target_data,
01293                      int template_res_num_1, int template_res_num_2,
01294                      int target_res_num_1, int target_res_num_2);
01295 
01296 
01297 pValType calc_dfire( ProspectParam *param, char res_a, char res_b, float dist );
01298 
01310 pValType calc_distconst(ProspectParam *param,
01311                                                 TemplateStruct *template_data,
01312                                                 TargetStruct *target_data,
01313                                                 int template_res_num_1, int template_res_num_2,
01314                                                 int target_res_num_1, int target_res_num_2);
01315 
01316 
01317 
01318 
01319 
01320 pValType calc_singledel(ProspectParam *param,
01321                                                 TemplateStruct *template_data,
01322                                                 int template_res_num);
01323 
01324 pValType calc_singleins(ProspectParam *param,
01325                                                 TemplateStruct *template_data,
01326                                                 int template_res_num);
01327 
01328 
01329 
01340 int ss_filter(ProspectParam *param,
01341                 TemplateStruct *template_data,
01342                 TargetStruct *target_data,
01343                 int core_num, int core_position);
01344 
01345         
01346 
01347 #define vUp        1
01348 #define vLeft      2
01349 #define vMatch     3
01350 
01351 
01352 class DynamicAlign {
01353 public:
01354         DynamicAlign() {
01355                 size_x = size_y = 0;
01356                 gap_open = 0;
01357                 gap_extend = 0;
01358                 energy_matrix = NULL;
01359                 score_matrix = NULL;
01360                 source_matrix = NULL;
01361         };      
01362         DynamicAlign(int in_x, int in_y)  {
01363                 energy_matrix = NULL;
01364                 score_matrix = NULL;
01365                 source_matrix = NULL;
01366                 SetDim( in_x, in_y );           
01367         };      
01368         virtual ~DynamicAlign() {
01369                 FreeMem();
01370         }
01371         void FreeMem(void) {            
01372                 if ( energy_matrix ) {
01373                         free( energy_matrix[0] );
01374                         free( energy_matrix );
01375                 }
01376                 energy_matrix = NULL;
01377                 if ( score_matrix ) {
01378                         free( score_matrix[0] );
01379                         free( score_matrix );
01380                 }
01381                 score_matrix = NULL;
01382                 if ( source_matrix ) {
01383                         free( source_matrix[0] );
01384                         free( source_matrix );
01385                 }
01386                 source_matrix = NULL;
01387                 size_x = size_y = 0;
01388                 gap_open = 0;
01389                 gap_extend = 0;
01390         }       
01391         //virtual void CalcEnergyTable();
01392         
01393         void SetDim( int x, int y );
01394         
01395         void Align(void) { Align( 0,0,size_x,size_y); };
01396         virtual void Align( int start_x, int start_y, int end_x, int end_y, char start_state = vMatch, pValType start_val = 0.0 );
01397         void TraceAlign( int *align_x, int *align_y) {
01398                 TraceAlign( 0,0, size_x, size_y, align_x, align_y );
01399         };
01400         void TraceAlign( int start_x, int start_y, int end_x, int end_y,
01401                                          int *align_x, int *align_y);
01402         void TraceAlign( AlignmentStruct *out_align );
01403         pValType GetCellVal( int x, int y ) {
01404                 return score_matrix[x+1][y+1];
01405         }
01406         char GetCellState( int x, int y ) {
01407                 return source_matrix[x+1][y+1];
01408         }
01409         pValType GetCellEnergy( int x, int y ) {
01410                 return energy_matrix[x][y];
01411         }
01412 
01413         //for creative usage of the alignment matrix
01414         void SetCellState( int x, int y, int state ) {
01415                 source_matrix[x+1][y+1] = state;
01416         }
01417         void ContinueAlign( int start_x, int start_y );
01418         void ForceXDelete( int start_x, int len );
01419         void ForceYDelete( int start_y, int len );
01420         void ForceAlign( int start_x, int start_y, int len );
01421 
01422 protected:              
01423         int size_x, size_y;
01424         pValType **energy_matrix, **score_matrix, gap_open, gap_extend;
01425         char **source_matrix;   
01426 };
01427 
01428 
01429 class ProspectDynamicAlign : public DynamicAlign {
01430 public:
01431         virtual void CalcEnergyTable(ProspectParam *param,
01432                                                  WeightArray weights,   
01433                                                  TemplateStruct *template_data,
01434                                                  TargetStruct *target_data );
01435         
01436 };
01437 
01438 
01439 class ProspectDynamicCoreAlign : public ProspectDynamicAlign {
01440 private:
01441         pValType **extra_del_score, **extra_ins_score;  
01442 public:
01443         
01444         ProspectDynamicCoreAlign() : ProspectDynamicAlign() {
01445                 extra_del_score = NULL;
01446                 extra_ins_score = NULL;
01447         }
01448         ~ProspectDynamicCoreAlign()  {
01449                 if ( extra_del_score ) {
01450                         free( extra_del_score[0] );
01451                         free( extra_del_score );
01452                 }
01453                 extra_del_score = NULL;
01454                 if ( extra_ins_score ) {
01455                         free( extra_ins_score[0] );
01456                         free( extra_ins_score );
01457                 }
01458                 extra_ins_score = NULL;         
01459                 FreeMem();
01460         }       
01461         void CalcEnergyTable(ProspectParam *param,
01462                                                  WeightArray weights,   
01463                                                  TemplateStruct *template_data,
01464                                                  TargetStruct *target_data );   
01465         void Align(void) { Align( 0,0,size_x,size_y); };
01466         void Align( int start_x, int start_y, int end_x, int end_y, char start_state = vMatch, pValType start_val = 0.0 );      
01467 };
01468 
01473 char AA3toAA1(char * res);
01474 void AA1toAA3(char res, char *res_name);
01475 int AA1toAANum(char a);
01476 char AANumtoAA1(int a);
01477 
01478 int SS1toSSNum(char a);
01479 
01480 int PDBAtomtoNum( char *atom_name );
01481 
01482 int solvent_acc(char a, int template_acc);
01483 
01484 
01485 int solvent_sec_struct(TemplateStruct *template_data,
01486                        int template_res_num);
01487 
01488 
01489 
01490 void shuffle_seq(TargetStruct *q, TargetStruct *s_q);
01491 
01492 
01493 
01494 
01495 
01496 class ProspectThreadingInfo {
01497 public: 
01498         ProspectThreadingInfo();
01499         ~ProspectThreadingInfo();
01500         
01501 
01502         ProspectThreadingInfo(const ProspectThreadingInfo &rhs);        
01503         ProspectThreadingInfo & operator=(const ProspectThreadingInfo &rhs);    
01504 
01505         void Copy( const ProspectThreadingInfo &rhs);
01506         void Free(void);
01507         
01508         pValType Score_Calc_NN( void );
01509         /*
01510         pValType GetAlignPercent(void) {
01511                 return (pValType)nalign/(pValType)align.target_len;
01512         }
01513          */
01514 
01515         pValType GetEnergy( int energy_id ) {
01516                 return energy[ energy_id ];
01517         }
01518         pValType GetAveRaw(void);
01519         void ExtractTarget( TargetStruct *target_in, int start = -1, int stop = -1);
01520         
01521         void  SetScoreExtra(int extra_num, float val );
01522         float GetScoreExtra(int extra_num  );
01523 
01524         
01525         class ProspectOutput *parent;
01526                 
01527         char *template_name;
01528         ScoreStruct scores;
01529         pValType score_extra;
01530         char *align_target_ss, *align_target_seq, *align_match, *align_template_ss, *align_template_seq;
01531         char *template_rs, *target_rs, *template_ss, *target_ss;
01532         long rank;
01533 //      double extra_score;
01534         char *pdb_text;
01535         
01536         //int nalign, npair_align, nalign_core_res, nalign_core, nident;
01537                 
01538         AlignmentStruct align;
01539         AlignFeatures features;
01540         EnergyArray  energy;
01541         WeightArray  weight;
01542                 
01543         int target_len, template_len, core_count, core_res_count;
01544         TemplateCoreDefinition *core;           
01545         ResidueAtoms *residue_atoms;    
01546         pValType lret;
01547         int atom_count;
01548         
01549         void *xml_node; 
01550 };
01551 
01552 
01553 
01554 
01555 class ProspectOutput {
01556 public: 
01557         ProspectOutput(char *path = NULL);
01558         ~ProspectOutput();      
01559         
01560         void Free(void);
01561         
01562         int Load( char *path);
01563         int Save( char *path);
01564         
01565         int AddThreadingInfo( ProspectThreadingInfo *thread_info );
01566         int AddThreadingInfo( ProspectParam *param,
01567                                                   WeightArray weight,   
01568                                                   TemplateStruct *template_data,
01569                                                   TargetStruct *target_data, 
01570                                                   ScoreStruct *score,
01571                                                   AlignmentStruct *alignment);
01572         
01573         int GetThreadingCount( void);
01574         char * GetTemplateName( int N);
01575         int GetTemplateNum( char *);
01576         
01577         ProspectThreadingInfo GetThreadingInfo( int N );
01578         
01579         int GetThreadingInfo( int N, ProspectThreadingInfo *thread_info);
01580         int GetThreadingInfo( const char * name, ProspectThreadingInfo *thread_info);
01581         int Get_PDBText( int N, ProspectThreadingInfo *thread_info);    
01582         void Sort( int feature );
01583         void Sort( char *eqn, bool minimize = true);
01584         void Sort( class ThreadFeatureParse *sort_func, bool minimize = true );
01585         //void SortScoreUser(  bool minimize = true );
01586         void SetSortVal( int i, float val);
01587         float GetSortVal( int i );
01588         
01589         int GetRank(int i) { if (reorder) return reorder[i]; return i;} ;
01590         /*
01591         void SetScoreExtra( int i, int extra_num, float val );
01592         float GetScoreExtra( int i, int extra_num  );
01593         */
01594         void GetRawNormalize( float &mean, float &sd );
01595         
01596 protected:
01597                 friend class ThreadFeatureParse;
01598         //a pointer that actually points to a xmlDocPtr, but is kept char * to 
01599         //skip the compication of needing the libxml headers when compiling
01600         void * output_xml_handle;       
01601         int *reorder;
01602         float *sort_val;
01603 };
01604 
01605 
01606 
01607 #define FPOP_SET  1
01608 #define FPOP_GET  2
01609 #define FPOP_ADD  3
01610 #define FPOP_SUB  4
01611 #define FPOP_MUL  5
01612 #define FPOP_DIV  6
01613 #define FPOP_POW  7
01614 #define FPOP_SRT  8
01615 #define FPOP_LOG  9
01616 #define FPOP_SIN  10
01617 #define FPOP_COS  11
01618 #define FPOP_NEG  12
01619 #define FPOP_ABS  13
01620 #define FPOP_RES  14
01621 
01622 typedef struct feature_parse_op {
01623         int op_code;
01624         union {
01625                 int reg[2];
01626                 double val;
01627         } op_arg;
01628         int mem_store;
01629 } feature_parse_op;
01630 
01631 
01632 class ThreadFeatureParse {
01633 public:
01634         ThreadFeatureParse ();
01635         ThreadFeatureParse( feature_parse_op *op_list, int op_count, int mem_size );
01636         ThreadFeatureParse( char *eqn_str );
01637         ThreadFeatureParse & operator =( const ThreadFeatureParse &rhs );
01638         void Copy(const ThreadFeatureParse &rhs);
01639         ~ThreadFeatureParse();
01640         
01641         
01642   float RunParse( ProspectThreadingInfo *thread );
01643   float *RunParse( ProspectOutput *threads );
01644 
01645   static ThreadFeatureParse *CompileParse(char *str);
01646 
01647         static float calc_averaw( ProspectThreadingInfo *thread, int foo = 0);
01648         static float get_score( ProspectThreadingInfo *thread, int feature ) {
01649                 return thread->scores.values[ feature ];
01650         };
01651         /*
01652         static float get_user_score( ProspectThreadingInfo *thread, int feature ) {
01653                 if ( thread == NULL || thread->parent == NULL )
01654                         return 0;
01655                 return thread->parent->GetScoreExtra( thread->parent->GetTemplateNum( thread->template_name ), feature );
01656         };
01657         static float *get_user_score_array( ProspectOutput *threads, int feature );
01658         */
01659         static float get_score_mean( ProspectThreadingInfo *thread, int feature ) {
01660                 return thread->scores.z_mean[ feature ];
01661         };
01662         
01663         static float get_score_sd( ProspectThreadingInfo *thread, int feature ) {
01664                 return thread->scores.z_sd[ feature ];
01665         };
01666         
01667         static float get_struct_feature( ProspectThreadingInfo *thread, int feature );
01668         static float get_align_feature( ProspectThreadingInfo *thread, int feature ) {
01669                 return thread->features.Get( feature );
01670         }
01671         static float get_raw_zscore( ProspectThreadingInfo *thread, int feature );
01672 
01673         static float get_target_frag_count( ProspectThreadingInfo *thread, int foo = 0) {
01674                 return thread->align.GetFragCount();
01675         }       
01676         static float get_weight( ProspectThreadingInfo *thread, int feature ) {
01677                 return thread->weight[ feature ];
01678         }
01679         static float get_energy( ProspectThreadingInfo *thread, int feature ) {
01680                 return thread->energy[ feature ];
01681         }
01682         static float get_energy_weight( ProspectThreadingInfo *thread, int feature ) {
01683                 return thread->energy[ feature ] * thread->weight[ feature ];
01684         }
01685                 
01686         static float *get_raw_zscore_array( ProspectOutput *threads, int feature );
01687         static float* get_score_array( ProspectOutput *threads, int feature );  
01688         static float* get_score_array_mean( ProspectOutput *threads, int feature );     
01689         static float* get_score_array_sd( ProspectOutput *threads, int feature );       
01690 
01691         static float* get_weight_array( ProspectOutput *threads, int feature ); 
01692         static float* get_energy_array( ProspectOutput *threads, int feature ); 
01693         static float* get_energy_weight_array( ProspectOutput *threads, int feature );  
01694         static float* get_align_feature_array( ProspectOutput *threads, int feature );  
01695         static float* get_struct_len_array( ProspectOutput *thread, int feature );
01696 
01697         static float GetFeatureFloat(  ProspectThreadingInfo *thread_info, char *str);
01698         static float GetFeatureFloat(  ProspectThreadingInfo *thread_info, int id);
01699         static int   GetFeatureID( char *str);
01700         static char *GetFeatureStr( ProspectThreadingInfo *thread_info, char *str);     
01701         static char *ParseFeatureStr( ProspectThreadingInfo *thread_info, char *str );  
01702         static float ParseFeatureEqn( ProspectThreadingInfo *thread_info, char *eqn_str );
01703 
01704  private:
01705                 float RunFeatureProgram( ProspectThreadingInfo *thread, float *feature_vals = NULL );
01706 
01707         feature_parse_op *ops;
01708         int op_count;
01709         double *mem;
01710         int mem_count;
01711 };
01712 
01713 
01714 
01715 class SasaCalc {
01716 public:
01717         SasaCalc(void) { };
01718         virtual ~SasaCalc(void) { };
01719         virtual float CalcResidueSasa( TargetStruct *target_data, int res) = 0;
01720         float CalcSasa( TargetStruct *target_data );
01721 };
01722 
01723 
01724 class PopsSasa : public SasaCalc, public ParamElement {
01725 public:
01726         PopsSasa(ProspectParam *in_parent, bool load = true);
01727         ~PopsSasa() {
01728                 if (params != NULL) 
01729                         free( params );
01730         }
01731         float CalcResidueSasa( TargetStruct *target_data, int res);
01732         pValType FindRadius( int atom_num );    
01733         pValType FindP( int atom_num ); 
01734 
01735 protected:
01736         PopsParam *params;
01737 };
01738 
01739 
01740 class PopsRSasa : public PopsSasa {
01741 public:
01742         PopsRSasa( ProspectParam *in_parent );  
01743 };
01744 
01745 class SimpleSasa :  public SasaCalc, public ParamElement {
01746 public:
01747         SimpleSasa(ProspectParam *in_parent) : SasaCalc(), ParamElement( in_parent ) { } ;
01748         float CalcResidueSasa( TargetStruct *target_data, int res);
01749 };
01750 
01751 
01752 class DsspSasa : public SasaCalc {
01753 public:
01754         DsspSasa() { len = 0; acc_val = NULL; };
01755         ~DsspSasa() { if ( acc_val ) delete acc_val; };
01756         void LoadDssp(char *path);
01757 
01758         float CalcResidueSasa( TargetStruct *target_data, int res);
01759 
01760 protected:
01761                 int len;
01762         float *acc_val;
01763 };
01764 
01765 #endif

Generated on Wed Apr 11 16:50:49 2007 for open_prospect by  doxygen 1.4.6