function summary_search_results($spectrum_id, $protein_name) { $ops = get_operations_by_name("all(0)/process protein(*)"); foreach ($ops as $op) { $proteinName = get_io_by_name($op['id'], "p.getName()", "protein name"); echo "<h4><a href=\"dump.php?id=" . $op['id'] . "\">" . $proteinName[0]['value'] . "</a></h4>"; $scores = get_operations_by_name("query digested peptides(*)/query digested peptide(*)/query all ptm variants(*)/QuerySequence(*)/test charge(*)/match candidate hypothesis(*)/Spectrum::ScoreSequenceVsSpectrum(*)", $op['id']); foreach ($scores as $score) { $seq_io = get_io_by_name($score['id'], "seq", "Sequence to match"); echo "<a href=\"dump.php?id=" . $score['id'] . "\">" . $seq_io[0]['value'] . "</a>"; #echo $seq_io[0]['value']; #var_dump($score); echo "<br/>"; } // $proteinSequence = get_io_by_name($op['id'], "protein/sequence()", "protein to query"); // $str = $proteinSequence[0]['value']; // $str2 = chunk_split($str, 10, ' '); // $str2 = chunk_split($str2, 88); // echo "<pre>$str2</pre><br/><br/>"; } }
function get_io_by_name($operation_id, $path, $note = '', $parent_io = -1) { global $io_for_object_parent_name_stmt; $names = preg_split('/\\//', $path, 2); $name = $names[0]; $remaining = $names[1]; $io_for_object_parent_name_stmt->bindParam('operation_id', $operation_id); $io_for_object_parent_name_stmt->bindParam('name', $name); $io_for_object_parent_name_stmt->bindParam('note', $note); $io_for_object_parent_name_stmt->bindParam('parent_io', $parent_io); // echo "SELECT * from io where operation_id = $operation_id AND name = \"$name\" and note = \"$note\" and parent_id = $parent_io;"; $io_for_object_parent_name_stmt->execute(); $ops = array(); while ($op = $io_for_object_parent_name_stmt->fetch(PDO::FETCH_ASSOC)) { $ops[] = $op; } $io_for_object_parent_name_stmt->closeCursor(); $result = array(); foreach ($ops as $op) { if ($remaining == '') { $result[] = $op; } else { $result = array_merge($result, get_io_by_name($operation_id, $remaining, $note, $op['id'])); } } return $result; }