Skip to content

Commit

Permalink
Retrieve proteins for diseases
Browse files Browse the repository at this point in the history
  • Loading branch information
ttsudipto committed Jan 19, 2024
1 parent 029d3f1 commit 034d2f4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions get_diseases.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php
include('db.php');

$concise = false;
if (array_key_exists("concise", $_GET))
if ($_GET["concise"] == "1")
$concise = true;
$key = urldecode($_GET['key']);
// echo $key."<br/>";

Expand All @@ -19,6 +23,21 @@
$diseaseStmt->execute();
$diseaseRows = execute_and_fetch_assoc($diseaseStmt);
$diseaseStmt->close();
if (! $concise) {
for($i=0; $i<count($diseaseRows); ++$i){
$proteinQuery = "select protein.UniProtAccession,GeneName from protein inner join protein_disease_association on protein.UniProtAccession=protein_disease_association.UniProtAccession where MADID=?;";
// echo $proteinQuery."<br/>";
$proteinStmt = $conn->prepare($proteinQuery);
$proteinStmt->bind_param("s", $diseaseRows[$i]["MADID"]);
$proteinStmt->execute();
$proteinRows = execute_and_fetch_assoc($proteinStmt);
$proteins = array();
for ($j=0; $j<count($proteinRows); ++$j)
array_push($proteins, $proteinRows[$j]["GeneName"]." (<a href=\"protein.php?keytype=ID&key=".$proteinRows[$j]["UniProtAccession"]."\">".$proteinRows[$j]["UniProtAccession"]."</a>)");
$diseaseRows[$i]["ProteinAssociations"] = implode("; ", $proteins);
}
}

closeConnection($conn);
$rowsJSON = json_encode($diseaseRows);
echo $rowsJSON;
Expand Down

0 comments on commit 034d2f4

Please sign in to comment.