Simply place query using the options bellow.

'; } else { echo '
'; } ?>

Query on detail

Query on XRay method

Query on NMR method

Query on structure parameter of single residue

Query on structure parameter of dinucleotide

Residue 1
Residue 2
'; } ?>


Hints

Query on detail: method – choose "SOLUTION NMR" or "X-RAY DIFFRACTION".
Query on detail: date of deposition/release – insert date in format YYYY-MM-DD.

'" . $_POST["detail"] . "'"; break; case 'lt': $where .= "<'" . $_POST["detail"] . "'"; break; case 'gte': $where .= ">='" . $_POST["detail"] . "'"; break; case 'lte': $where .= "<='" . $_POST["detail"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["detail"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["detailOperation"] . '

'; } $newLogic=strtoupper($_POST["detailLogic"]); // process addeed conditions $i = 2; while (isset($_POST["detail_$i"])) { $where .= " $newLogic "; $where .= $_POST["detailSelect_$i"] . " "; switch($_POST["detailOperation_$i"]) { case 'eq': $where .= "='" . $_POST["detail_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["detail_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["detail_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["detail_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["detail_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["detail_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["detail_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["detailOperation_$i"] . '

'; } $newLogic=strtoupper($_POST["detailLogic_$i"]); $i++; } $query="SELECT biomoleculeId FROM biomoleculeData WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on biomoleculeData: $query
"; } $result = pg_exec($link, $query); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on biomoleculeData: " . $row[0] . "
"; } array_push($results, $row[0]); } } // query on methodXRAYData $where=""; $newLogic=""; if (($_POST["xray"] != "") || ($_POST["xrayOperation"] == "null") || ($_POST["xrayOperation"] == "notnull")) { $where .= $_POST["xraySelect"] . " "; switch($_POST["xrayOperation"]) { case 'eq': $where .= "='" . $_POST["xray"] . "'"; break; case 'ne': $where .= "!='" . $_POST["xray"] . "'"; break; case 'gt': $where .= ">'" . $_POST["xray"] . "'"; break; case 'lt': $where .= "<'" . $_POST["xray"] . "'"; break; case 'gte': $where .= ">='" . $_POST["xray"] . "'"; break; case 'lte': $where .= "<='" . $_POST["xray"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["xray"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["xrayOperation"] . '

'; } $newLogic=strtoupper($_POST["xrayLogic"]); // process addeed conditions $i = 2; while (isset($_POST["xray_$i"])) { $where .= " $newLogic "; $where .= $_POST["xraySelect_$i"] . " "; switch($_POST["xrayOperation_$i"]) { case 'eq': $where .= "='" . $_POST["xray_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["xray_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["xray_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["xray_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["xray_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["xray_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["xray_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["xrayOperation_$i"] . '

'; } $newLogic=strtoupper($_POST["xrayLogic_$i"]); $i++; } $query="SELECT biomoleculeDataId FROM methodXRAYData WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on methodXRAYData: $query
"; } $result = pg_exec($link, $query); $linkResults = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: link result on methodXRAYData: " . $row[0] . "
"; } array_push($linkResults, $row[0]); } if (sizeof($linkResults) > 0) { $query="SELECT biomoleculeId FROM biomoleculeData WHERE 1=0"; foreach($linkResults as $biomoleculeDataId) { $query.=" OR id=$biomoleculeDataId"; } $query .=";"; if (isset($_POST["debug"])) { echo "DEBUG: SQL link query for methodXRAYData: $query
"; } $result = pg_exec($link, $query); $inserting = sizeof($results); if ($inserting) { // unite result array with new results $tempResults = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on methodXRAYData: " . $row[0] . "
"; } array_push($tempResults, $row[0]); } $results = array_intersect($results, $tempResults); if (isset($_POST["debug"])) { foreach ($results as $item) { echo "DEBUG: united result on biomoleculeData: " . $item . "
"; } } } else { // insert data into results array while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on biomoleculeData: " . $row[0] . "
"; } array_push($results, $row[0]); } } } } // query on methodNMRData $where=""; $newLogic=""; if (($_POST["nmr"] != "") || ($_POST["nmrOperation"] == "null") || ($_POST["nmrOperation"] == "notnull")) { $where .= $_POST["nmrSelect"] . " "; switch($_POST["nmrOperation"]) { case 'eq': $where .= "='" . $_POST["nmr"] . "'"; break; case 'ne': $where .= "!='" . $_POST["nmr"] . "'"; break; case 'gt': $where .= ">'" . $_POST["nmr"] . "'"; break; case 'lt': $where .= "<'" . $_POST["nmr"] . "'"; break; case 'gte': $where .= ">='" . $_POST["nmr"] . "'"; break; case 'lte': $where .= "<='" . $_POST["nmr"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["nmr"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["nmrOperation"] . '

'; } $newLogic=strtoupper($_POST["nmrLogic"]); // process addeed conditions $i = 2; while (isset($_POST["nmr_$i"])) { $where .= " $newLogic "; $where .= $_POST["nmrSelect_$i"] . " "; switch($_POST["nmrOperation_$i"]) { case 'eq': $where .= "='" . $_POST["nmr_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["nmr_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["nmr_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["nmr_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["nmr_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["nmr_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["nmr_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["nmrOperation_$i"] . '

'; } $newLogic=strtoupper($_POST["nmrLogic_$i"]); $i++; } $query="SELECT biomoleculeDataId FROM methodNMRData WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on methodNMRData: $query
"; } $result = pg_exec($link, $query); $linkResults = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: link result on methodNMRData: " . $row[0] . "
"; } array_push($linkResults, $row[0]); } if (sizeof($linkResults) > 0) { $query="SELECT biomoleculeId FROM biomoleculeData WHERE 1=0"; foreach($linkResults as $biomoleculeDataId) { $query.=" OR id=$biomoleculeDataId"; } $query .=";"; if (isset($_POST["debug"])) { echo "DEBUG: SQL link query for methodNMRData: $query
"; } $result = pg_exec($link, $query); $inserting = sizeof($results); if ($inserting) { // unite result array with new results $tempResults = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on methodNMRData: " . $row[0] . "
"; } array_push($tempResults, $row[0]); } $results = array_intersect($results, $tempResults); if (isset($_POST["debug"])) { foreach ($results as $item) { echo "DEBUG: united result on biomoleculeData: " . $item . "
"; } } } else { // insert data into results array while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on biomoleculeData: " . $row[0] . "
"; } array_push($results, $row[0]); } } } } // query on structureParameter $where=""; $newLogic=""; $tables=array(); if (($_POST["structure"] != "") || ($_POST["structureOperation"] == "null") || ($_POST["structureOperation"] == "notnull")) { $where .= $_POST["structureSelect"] . " "; switch($_POST["structureSelect"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["structureSelect"] . '

'; } switch($_POST["structureOperation"]) { case 'eq': $where .= "='" . $_POST["structure"] . "'"; break; case 'ne': $where .= "!='" . $_POST["structure"] . "'"; break; case 'gt': $where .= ">'" . $_POST["structure"] . "'"; break; case 'lt': $where .= "<'" . $_POST["structure"] . "'"; break; case 'gte': $where .= ">='" . $_POST["structure"] . "'"; break; case 'lte': $where .= "<='" . $_POST["structure"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["structure"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["structureOperation"] . '

'; } $newLogic=strtoupper($_POST["structureLogic"]); // process addeed conditions $i = 2; while (isset($_POST["structure_$i"])) { $where .= " $newLogic "; $where .= $_POST["structureSelect_$i"] . " "; switch($_POST["structureSelect_$i"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["structureSelect"] . '

'; } switch($_POST["structureOperation_$i"]) { case 'eq': $where .= "='" . $_POST["structure_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["structure_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["structure_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["structure_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["structure_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["structure_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["structure_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["structureOperation_$i"] . '

'; } $newLogic=strtoupper($_POST["structureLogic_$i"]); $i++; } $from=""; $select=key($tables); if (count($tables) == 1) { $from = $select; array_push($highlightTables, $from); } else { foreach ($tables as $table => $used) { array_push($highlightTables, $table); if ($from == "") { $from = "$table"; $tablePrev = $table; continue; } else { $from .= " JOIN $table ON $tablePrev.residueId=$table.residueId"; $tablePrev = $table; } } } $query="SELECT $select.residueId FROM $from WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on structureparameter: $query
"; } $result = pg_exec($link, $query); $linkResults = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: link result on structureparameter: " . $row[0] . "
"; } array_push($linkResults, $row[0]); array_push($highlightResidue, $row[0]); } if (sizeof($linkResults) > 0) { $query="SELECT DISTINCT biomoleculeId FROM chain JOIN residue ON chain.id=residue.chainId WHERE 1=0"; $stack = 0; $done = 0; $inserting = sizeof($results); $tempResults = array(); foreach($linkResults as $biomoleculeDataId) { $done++; if (($stack < 50) && (($done) != count($linkResults))) { $query.=" OR residue.id=$biomoleculeDataId"; $stack++; } else { if ($done == count($linkResults)) { $query.=" OR residue.id=$biomoleculeDataId"; } if (isset($_POST["debug"])) { echo "DEBUG: SQL link query for structureparameter: $query
"; } $result = pg_exec($link, $query); if ($inserting) { while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: temp result on structureparameter: " . $row[0] . "
"; } array_push($tempResults, $row[0]); } } else { // insert data into results array while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on sturctureparameter: " . $row[0] . "
"; } if (!in_array($row[0], $results)) { array_push($results, $row[0]); } } } // new cycle $query="SELECT DISTINCT biomoleculeId FROM chain JOIN residue ON chain.id=residue.chainId WHERE 1=0"; $stack = 0; } } // now we can perform intersection, the tempResults is ready if ($inserting) { if (isset($_POST["debug"])) { echo "DEBUG: results: " . count($results) . "
"; echo "DEBUG: results: " . count($tempResults) . "
"; } $results = array_intersect($results, $tempResults); if (isset($_POST["debug"])) { echo "DEBUG: results: " . count($results) . "
"; } if (isset($_POST["debug"])) { foreach ($results as $item) { echo "DEBUG: united result on structureparamter: " . $item . "
"; } } } } } // query on dinucleotide1 $where=""; $newLogic=""; $tables=array(); if (($_POST["dinucleotide1"] != "") || ($_POST["dinucleotide1Operation"] == "null") || ($_POST["dinucleotide1Operation"] == "notnull")) { $where .= $_POST["dinucleotide1Select"] . " "; switch($_POST["dinucleotide1Select"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["dinucleotide1Select"] . '

'; } switch($_POST["dinucleotide1Operation"]) { case 'eq': $where .= "='" . $_POST["dinucleotide1"] . "'"; break; case 'ne': $where .= "!='" . $_POST["dinucleotide1"] . "'"; break; case 'gt': $where .= ">'" . $_POST["dinucleotide1"] . "'"; break; case 'lt': $where .= "<'" . $_POST["dinucleotide1"] . "'"; break; case 'gte': $where .= ">='" . $_POST["dinucleotide1"] . "'"; break; case 'lte': $where .= "<='" . $_POST["dinucleotide1"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["dinucleotide1"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["dinucleotide1Operation"] . '

'; } $newLogic=strtoupper($_POST["dinucleotide1Logic"]); // process addeed conditions $i = 2; while (isset($_POST["dinucleotide1_$i"])) { $where .= " $newLogic "; $where .= $_POST["dinucleotide1Select_$i"] . " "; switch($_POST["dinucleotide1Select_$i"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["dinucleotide1Select"] . '

'; } switch($_POST["dinucleotide1Operation_$i"]) { case 'eq': $where .= "='" . $_POST["dinucleotide1_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["dinucleotide1_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["dinucleotide1_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["dinucleotide1_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["dinucleotide1_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["dinucleotide1_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["dinucleotide1_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["dinucleotide1Operation_$i"] . '

'; } $newLogic=strtoupper($_POST["dinucleotide1Logic_$i"]); $i++; } $from=""; $select=key($tables); if (count($tables) == 1) { $from = $select; array_push($highlightTables, $from); } else { foreach ($tables as $table => $used) { array_push($highlightTables, $table); if ($from == "") { $from = "$table"; $tablePrev = $table; continue; } else { $from .= " JOIN $table ON $tablePrev.residueId=$table.residueId"; $tablePrev = $table; } } } $from .= " JOIN residue ON $select.residueId=residue.id"; $query="SELECT $select.residueId, residue.chainId, residue.position FROM $from WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on structureparameter dinucleotide1: $query
"; } $result = pg_exec($link, $query); $linkResultsResidue1 = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: link result on structureparameter dinucleotide1: " . $row[0] . "
"; } //array_push($linkResultsResidue1, $row[0]); // chain, position, residueId $linkResultsResidue1[$row[1]][$row[2]] = $row[0]; } } // query on dinucleotide2 $where=""; $newLogic=""; $tables=array(); if (($_POST["dinucleotide2"] != "") || ($_POST["dinucleotide2Operation"] == "null") || ($_POST["dinucleotide2Operation"] == "notnull")) { $where .= $_POST["dinucleotide2Select"] . " "; switch($_POST["dinucleotide2Select"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["dinucleotide2Select"] . '

'; } switch($_POST["dinucleotide2Operation"]) { case 'eq': $where .= "='" . $_POST["dinucleotide2"] . "'"; break; case 'ne': $where .= "!='" . $_POST["dinucleotide2"] . "'"; break; case 'gt': $where .= ">'" . $_POST["dinucleotide2"] . "'"; break; case 'lt': $where .= "<'" . $_POST["dinucleotide2"] . "'"; break; case 'gte': $where .= ">='" . $_POST["dinucleotide2"] . "'"; break; case 'lte': $where .= "<='" . $_POST["dinucleotide2"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["dinucleotide2"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["dinucleotide2Operation"] . '

'; } $newLogic=strtoupper($_POST["dinucleotide2Logic"]); // process addeed conditions $i = 2; while (isset($_POST["dinucleotide2_$i"])) { $where .= " $newLogic "; $where .= $_POST["dinucleotide2Select_$i"] . " "; switch($_POST["dinucleotide2Select_$i"]) { case 'shear': case 'stretch': case 'stagger': case 'buckle': case 'propeller': case 'opening': case 'shift': case 'slide': case 'rise': case 'tilt': case 'roll': case 'twist': $tables['StructureParameter'] = 1; break; case 'i1_i2': case 'i1_i2Ring': case 'i1_j2': case 'i1_j2Ring': case 'j1_i2': case 'j1_i2Ring': case 'j1_j2': case 'j1_j2Ring': $tables['OverlapArea'] = 1; break; case 'Ox': case 'Oy': case 'Oz': case 'Nx': case 'Ny': case 'Nz': $tables['OriginMeanNormalVector'] = 1; break; case 'X_disp': case 'Y_disp': case 'h_Rise': case 'Incl': case 'Tip': case 'h_Twist': $tables['HelicalParameter'] = 1; break; case 'Xp': case 'Yp': case 'Zp': case 'XpH': case 'YpH': case 'ZpH': $tables['StepClassification'] = 1; break; case 'disp': case 'angle': $tables['C1GlobalParameter'] = 1; break; case 'alpha': case 'beta': case 'gamma': case 'delta': case 'epsilon': case 'zeta': case 'chi': $tables['TorsionAngle'] = 1; break; case 'tm': case 'P': $tables['SugarConformationalParameter'] = 1; break; case 'PP': case 'C1C1': $tables['PCVirtualBondDistance'] = 1; break; case 'P': case 'O4': case 'C1': $tables['HelixRadiusRadialDisplacement'] = 1; break; case'Px': case'Py': case'Pz': case'Hx': case'Hy': case'Hz': $tables['PositionAndLocalHelicalAxisVector'] = 1; break; default: echo '

ERROR: internal error - unknow structure parameter ' . $_POST["dinucleotide2Select"] . '

'; } switch($_POST["dinucleotide2Operation_$i"]) { case 'eq': $where .= "='" . $_POST["dinucleotide2_$i"] . "'"; break; case 'ne': $where .= "!='" . $_POST["dinucleotide2_$i"] . "'"; break; case 'gt': $where .= ">'" . $_POST["dinucleotide2_$i"] . "'"; break; case 'lt': $where .= "<'" . $_POST["dinucleotide2_$i"] . "'"; break; case 'gte': $where .= ">='" . $_POST["dinucleotide2_$i"] . "'"; break; case 'lte': $where .= "<='" . $_POST["dinucleotide2_$i"] . "'"; break; case 'like': $where .= "LIKE '%" . $_POST["dinucleotide2_$i"] . "%'"; break; case 'null': $where .= "IS NULL"; break; case 'notnull': $where .= "IS NOT NULL"; break; default: echo '

ERROR: internal error - unknow operation ' . $_POST["dinucleotide2Operation_$i"] . '

'; } $newLogic=strtoupper($_POST["dinucleotide2Logic_$i"]); $i++; } $from=""; $select=key($tables); if (count($tables) == 1) { $from = $select; array_push($highlightTables, $from); } else { foreach ($tables as $table => $used) { array_push($highlightTables, $table); if ($from == "") { $from = "$table"; $tablePrev = $table; continue; } else { $from .= " JOIN $table ON $tablePrev.residueId=$table.residueId"; $tablePrev = $table; } } } $from .= " JOIN residue ON $select.residueId=residue.id"; $query="SELECT $select.residueId, residue.chainId, residue.position FROM $from WHERE $where;"; if (isset($_POST["debug"])) { echo "DEBUG: SQL query on structureparameter dinucleotide2: $query
"; } $result = pg_exec($link, $query); $linkResultsResidue2 = array(); while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: link result on structureparameter dinucleotide2: " . $row[0] . "
"; } // chain, position, residueId $linkResultsResidue2[$row[1]][$row[2]] = $row[0]; } // evaluation of aswer -- selection to dinucleotides $linkResults = array(); if (isset($_POST["debug"])) { echo "DEBUG: dinucleotide1 (size " . count($linkResultsResidue1, COUNT_RECURSIVE) . ")
"; print_r($linkResultsResidue1); echo "
DEBUG: dinucleotide2 (size " . count($linkResultsResidue2, COUNT_RECURSIVE) . ")
"; print_r($linkResultsResidue2); } // choose smaller array to joining if (count($linkResultsResidue1, COUNT_RECURSIVE) < count($linkResultsResidue2, COUNT_RECURSIVE)) { $linkResultsNeedle = $linkResultsResidue1; $linkResultsHaystack = $linkResultsResidue2; $linkResultOperationIsAdd = true; if (isset($_POST["debug"])) { echo "DEBUG: needle is residue1, position+
"; } } else { $linkResultsNeedle = $linkResultsResidue2; $linkResultsHaystack = $linkResultsResidue1; $linkResultOperationIsAdd = false; if (isset($_POST["debug"])) { echo "DEBUG: needle is residue2, position-
"; } } foreach ($linkResultsNeedle as $key => $value) { if (isset($_POST["debug"])) { echo "DEBUG: checking key " . $key . " -> value " . key($value) . "
"; if($linkResultOperationIsAdd){ echo "DEBUG: operation is add
"; } else { echo "DEBUG: operation is sub
"; } } $position = key($value); if($linkResultOperationIsAdd){ $position++; } else { $position--; } if ($linkResultsHaystack[$key][$position]){ if (isset($_POST["debug"])) { echo "DEBUG: got match on dinucleid (" . $linkResultsHaystack[$key][$position] .")!
"; } array_push($linkResults, $linkResultsHaystack[$key][$position]); array_push($highlightResidue, $linkResultsHaystack[$key][key($value)]); array_push($highlightResidue, $linkResultsHaystack[$key][$position]); } } if (sizeof($linkResults) > 0) { $query="SELECT DISTINCT biomoleculeId FROM chain JOIN residue ON chain.id=residue.chainId WHERE 1=0"; $stack = 0; $done = 0; $inserting = sizeof($results); $tempResults = array(); foreach($linkResults as $biomoleculeDataId) { $done++; if (($stack < 50) && (($done) != count($linkResults))) { $query.=" OR residue.id=$biomoleculeDataId"; $stack++; } else { if ($done == count($linkResults)) { $query.=" OR residue.id=$biomoleculeDataId"; } if (isset($_POST["debug"])) { echo "DEBUG: SQL link query for structureparameter: $query
"; } $result = pg_exec($link, $query); if ($inserting) { while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: temp result on structureparameter: " . $row[0] . "
"; } array_push($tempResults, $row[0]); } } else { // insert data into results array while($row = pg_fetch_row($result)) { if (isset($_POST["debug"])) { echo "DEBUG: result on sturctureparameter: " . $row[0] . "
"; } if (!in_array($row[0], $results)) { array_push($results, $row[0]); } } } // new cycle $query="SELECT DISTINCT biomoleculeId FROM chain JOIN residue ON chain.id=residue.chainId WHERE 1=0"; $stack = 0; } } // now we can perform intersection, the tempResults is ready if ($inserting) { if (isset($_POST["debug"])) { echo "DEBUG: results: " . count($results) . "
"; echo "DEBUG: results: " . count($tempResults) . "
"; } $results = array_intersect($results, $tempResults); if (isset($_POST["debug"])) { echo "DEBUG: results: " . count($results) . "
"; } if (isset($_POST["debug"])) { foreach ($results as $item) { echo "DEBUG: united result on structureparamter: " . $item . "
"; } } } } } $seconds = microtime(true) - $seconds; // $seconds = $seconds / 1000; echo "

Query requirements met " . sizeof($results) . " result(s). Query took " . number_format($seconds, 2) . " seconds.

"; if (sizeof($results) > 0) { echo '

Results

'; echo ''; echo ''; $query = "SELECT pdbcode, name FROM biomolecule JOIN biomoleculeData ON biomolecule.id=biomoleculeData.biomoleculeId WHERE 1=0"; foreach($results as $biomoleculeId) { $query.=" OR biomolecule.id=$biomoleculeId"; } $query .=";"; $result = pg_exec($link, $query); while ($row = pg_fetch_row($result)){ echo '"; echo ''; } echo '
PDB IDNameActions
'; if ($uriRewrites == "yes"){ echo '' . $row[0] . ''; } else { echo $row[0]; echo '' . $row[0] . ''; } echo '' . $row[1] . "'; if ($uriRewrites == "yes"){ echo 'detail '; echo 'delete '; } else { echo $row[0]; echo 'detail'; echo 'delete'; } echo '
'; } if ($uri_rewrite="yes") { echo ''; } else { echo ''; } #echo "DEBUG: highlight session array size: " . count($highlightResidue) . "
"; if (($residueHighlight == "yes") || (count($results) < 1000)) { $_SESSION['highlightResidue']=$highlightResidue; $_SESSION['highlightTables']=$highlightTables; } } ?>