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_operations_by_name($path, $parent_id = -1) { global $operation_by_name_stmt; $names = preg_split('/\\//', $path, 2); $current = $names[0]; $remaining = $names[1]; preg_match('/^(?P<name>.*)\\((?P<count>.*)\\)$/', $current, $matches); $name = $matches['name']; $count = $matches['count']; $operation_by_name_stmt->bindParam('parent', $parent_id); $operation_by_name_stmt->bindParam('name', $name); $operation_by_name_stmt->execute(); $ops_array = array(); while ($op = $operation_by_name_stmt->fetch(PDO::FETCH_ASSOC)) { $ops_array[] = $op; } $operation_by_name_stmt->closeCursor(); $result = array(); $i = 0; foreach ($ops_array as $op) { if ($count == '*' || intval($count) == $i) { if ($remaining == '') { $result[] = annotate($op); } else { $more_ops = get_operations_by_name($remaining, intval($op['id'])); $result = array_merge($result, $more_ops); } } $i++; } return $result; }