00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __STRING_H
00021 #include <string.h>
00022 #endif
00023
00024 #ifndef __SRV_PXML__
00025 #include "srv_pxml.h"
00026 #endif
00027
00028
00029
00030
00031
00032
00033 #define xml_nofmatches "NofMatches"
00034
00035 #define xml_ssm_input "SSMInput"
00036 #define xml_query "query"
00037 #define xml_target "target"
00038 #define xml_type "type"
00039 #define xml_pdbcode "pdbcode"
00040 #define xml_file "file"
00041
00042 #define xml_match "Match"
00043 #define xml_mtarget "Target"
00044 #define xml_mquery "Query"
00045 #define xml_name "name"
00046 #define xml_chain "chain"
00047
00048 #define xml_pscore "P-score"
00049 #define xml_zscore "Z-score"
00050 #define xml_rmsd "RMSD"
00051
00052 #define xml_rtmatrix "RTMatrix"
00053 #define xml_rxx "Rxx"
00054 #define xml_rxy "Rxy"
00055 #define xml_rxz "Rxz"
00056 #define xml_tx "Tx"
00057 #define xml_ryx "Ryx"
00058 #define xml_ryy "Ryy"
00059 #define xml_ryz "Ryz"
00060 #define xml_ty "Ty"
00061 #define xml_rzx "Rzx"
00062 #define xml_rzy "Rzy"
00063 #define xml_rzz "Rzz"
00064 #define xml_tz "Tz"
00065
00066 #define xmld_coorfile "Coordinate file"
00067 #define xmld_pdbentry "PDB entry"
00068 #define xmld_pdbarchive "PDB archive"
00069 #define xmld_scoparchive "SCOP archive"
00070 #define xmld_scopsubset "SCOP subset"
00071
00072
00073 CSSMXML::CSSMXML () : CXMLObject() {}
00074 CSSMXML::~CSSMXML() {}
00075
00076
00077 int CSSMXML::readSSMXML ( pstr FName ) {
00078 pstr Data;
00079 int rc;
00080
00081 lastMatchNo = -1;
00082 SSMMatch = NULL;
00083
00084 rc = ReadObject ( FName );
00085 if (rc) nMatches = -1;
00086 else {
00087 rc = GetData ( nMatches,xml_nofmatches,1 );
00088 if (rc) nMatches = -1;
00089 }
00090
00091 targetcode = -1;
00092 targetID = NULL;
00093
00094 Data = GetData ( xml_ssm_input">"xml_target">"xml_type,1 );
00095 if (Data) {
00096 if (!strcmp(Data,xmld_pdbentry)) {
00097 rc = GetData ( targetID,xml_ssm_input">"xml_target">"xml_pdbcode,1 );
00098 if (!rc) targetcode = target_pdbentry;
00099 } else if (!strcmp(Data,xmld_coorfile)) {
00100 rc = GetData ( targetID,xml_ssm_input">"xml_target">"xml_file,1 );
00101 if (!rc) targetcode = target_file;
00102 } else if (!strcmp(Data,xmld_pdbarchive)) {
00103 targetcode = target_pdb;
00104 } else if (!strcmp(Data,xmld_scoparchive)) {
00105 targetcode = target_scop;
00106 } else if (!strcmp(Data,xmld_scopsubset)) {
00107 targetcode = target_scopsubset;
00108 }
00109 } else
00110 rc = -4;
00111
00112 return rc;
00113 }
00114
00115 int CSSMXML::getNofMatches() {
00116 return nMatches;
00117 }
00118
00119 int CSSMXML::getQueryID ( pstr QueryID ) {
00120 pstr Data;
00121 Data = GetData ( xml_ssm_input">"xml_query">"xml_type,1 );
00122 if (!Data) return -1;
00123 if (!strcmp(Data,xmld_pdbentry)) {
00124 Data = GetData ( xml_ssm_input">"xml_query">"xml_pdbcode,1 );
00125 if (!Data) return -2;
00126 strcpy ( QueryID,Data );
00127 return query_pdbentry;
00128 } else if (!strcmp(Data,xmld_coorfile)) {
00129 Data = GetData ( xml_ssm_input">"xml_query">"xml_file,1 );
00130 if (!Data) return -3;
00131 strcpy ( QueryID,Data );
00132 return query_file;
00133 } else
00134 return -4;
00135 }
00136
00137
00138 int CSSMXML::getTargetID ( pstr TargetID, int matchNo ) {
00139 pstr Data;
00140 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00141 SSMMatch = GetObject ( xml_match,matchNo );
00142 if (!SSMMatch) return -5;
00143 Data = SSMMatch->GetData ( xml_mtarget">"xml_name,1 );
00144 if (!Data) return -6;
00145 strcpy ( TargetID,Data );
00146 return targetcode;
00147 }
00148
00149
00150 int CSSMXML::getQueryChain ( pstr chainID, int matchNo ) {
00151 pstr Data;
00152 chainID[0] = char(0);
00153 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00154 SSMMatch = GetObject ( xml_match,matchNo );
00155 if (!SSMMatch) return -1;
00156 Data = SSMMatch->GetData ( xml_mquery">"xml_chain,1 );
00157 if (!Data) return 1;
00158 strcpy ( chainID,Data );
00159 return 0;
00160 }
00161
00162 int CSSMXML::getTargetChain ( pstr chainID, int matchNo ) {
00163 pstr Data;
00164 chainID[0] = char(0);
00165 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00166 SSMMatch = GetObject ( xml_match,matchNo );
00167 if (!SSMMatch) return -1;
00168 Data = SSMMatch->GetData ( xml_mtarget">"xml_chain,1 );
00169 if (!Data) return 1;
00170 strcpy ( chainID,Data );
00171 return 0;
00172 }
00173
00174 realtype CSSMXML::getRPDBe ( int matchNo ) {
00175 realtype V;
00176 int rc;
00177 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00178 SSMMatch = GetObject ( xml_match,matchNo );
00179 if (!SSMMatch) return -1.0;
00180 rc = SSMMatch->GetData ( V,xml_rmsd,1 );
00181 if (rc) return -2.0;
00182 return V;
00183 }
00184
00185 realtype CSSMXML::getPScore ( int matchNo ) {
00186 realtype V;
00187 int rc;
00188 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00189 SSMMatch = GetObject ( xml_match,matchNo );
00190 if (!SSMMatch) return -1.0;
00191 rc = SSMMatch->GetData ( V,xml_pscore,1 );
00192 if (rc) return -2.0;
00193 return V;
00194 }
00195
00196 realtype CSSMXML::getZScore ( int matchNo ) {
00197 realtype V;
00198 int rc;
00199 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00200 SSMMatch = GetObject ( xml_match,matchNo );
00201 if (!SSMMatch) return -1.0;
00202 rc = SSMMatch->GetData ( V,xml_zscore,1 );
00203 if (rc) return -2.0;
00204 return V;
00205 }
00206
00207 int CSSMXML::getRTMatrix ( mat44 & RT, int matchNo ) {
00208 PCXMLObject RTMatrix;
00209 if ((!SSMMatch) || (lastMatchNo!=matchNo))
00210 SSMMatch = GetObject ( xml_match,matchNo );
00211 if (!SSMMatch) return -1;
00212 RTMatrix = SSMMatch->GetObject ( xml_rtmatrix,1 );
00213 if (RTMatrix->GetData(RT[0][0],xml_rxx,1)) return 1;
00214 if (RTMatrix->GetData(RT[0][1],xml_rxy,1)) return 2;
00215 if (RTMatrix->GetData(RT[0][2],xml_rxz,1)) return 3;
00216 if (RTMatrix->GetData(RT[0][3],xml_tx ,1)) return 4;
00217 if (RTMatrix->GetData(RT[1][0],xml_ryx,1)) return 5;
00218 if (RTMatrix->GetData(RT[1][1],xml_ryy,1)) return 6;
00219 if (RTMatrix->GetData(RT[1][2],xml_ryz,1)) return 7;
00220 if (RTMatrix->GetData(RT[1][3],xml_ty ,1)) return 8;
00221 if (RTMatrix->GetData(RT[2][0],xml_rzx,1)) return 9;
00222 if (RTMatrix->GetData(RT[2][1],xml_rzy,1)) return 10;
00223 if (RTMatrix->GetData(RT[2][2],xml_rzz,1)) return 11;
00224 if (RTMatrix->GetData(RT[2][3],xml_tz ,1)) return 12;
00225 return 0;
00226 }
00227
00228
00229