<form id="{$row['tag_id']}_frm"> <input type="hidden" name="url" value="{$root_path}/annotate_marker.php?db={$database}&batch_id={$batch_id}&tag_id={$row['tag_id']}" /> <input type="input" size=15 name="ext_id" value="" /> <a onclick="annotate_marker('{$row['tag_id']}')">save</a>|<a onclick="toggle_annotation('{$row['tag_id']}')">cancel</a> </form> </div> </div> </td> EOQ; if (count($snps) == 0) { print " <td>No</td>\n"; } else { print " <td>Yes <span class=\"s\">[" . count($snps) . "nuc]</span></td>\n"; } $s = print_snps($row['tag_id'], $row['seq'], $row['seq'], $snps, true); $ratio = explode(";", $row['ratio']); $ratio_parsed = ""; $i = 0; foreach ($ratio as $r) { if (strlen($r) == 0) { continue; } preg_match("/([a-z]+):(\\d+)\\((\\d+\\.?\\d*%)\\)/", $r, $matches); for ($j = 0; $j < strlen($matches[1]); $j++) { $color = $color_map[$matches[1][$j]]; $ratio_parsed .= "<span style=\"color: {$color}; font-weight: bold\">" . $matches[1][$j] . "</span>"; } $ratio_parsed .= ": {$matches['2']}"; if ($matches[3] > 0) { $ratio_parsed .= " ({$matches['3']})";
if ($row['relationship'] == "model") { $model = $row['seq']; } else { if ($row['relationship'] == "secondary") { array_push($secondary, array('s' => $row['seq'], 'id' => $row['seq_id'])); } else { if (!isset($stacks[$row['sub_id']])) { $stacks[$row['sub_id']] = array(); } array_push($stacks[$row['sub_id']], array('s' => $row['seq'], 'id' => $row['seq_id'])); } } } } $con_len = strlen($consensus); $c = print_snps($tags[$i], $consensus, $consensus, $snps, false); $c = addslashes($c); $scale = print_scale($con_len); $scale = addslashes($scale); $json_str .= "{" . "\"sample_id\": \"{$sample_id}\"," . "\"sample_name\": \"{$file}\"," . "\"tag_id\": \"{$tag_id}\"," . "\"consensus\": \"{$c}\"," . "\"model\": \"{$model}\"," . "\"scale\": \"{$scale}\"," . "\"primary\": ["; foreach ($stacks as $sub_id => $stack) { $s = print_snps_errs($consensus, $stack[0]['s'], $snps, $cat_snps); $s = addslashes($s); $json_str .= "{" . "\"seq\": \"{$s}\"," . "\"ids\": ["; foreach ($stack as $seq) { $json_str .= "\"{$seq['id']}\","; } if (count($stack) > 0) { $json_str = substr($json_str, 0, -1); } $json_str .= "]" . "},";