Esempio n. 1
0
function write_pop_filter($cols)
{
    global $img_path, $root_path, $display;
    $max_chr_len = 0;
    $hidden_vars = generate_hidden_form_vars("filter");
    $chrs = fetch_chrs($max_chr_len);
    $filters = array("cata" => array(), "alle" => array(), "snps" => array(), "pare" => array(), "gcnt" => array(), "lnl" => array(), "loc" => array(), "ref" => array(), "est" => array(), "pe" => array(), "blast" => array());
    $fall = isset($display['filter_alle_l']) ? $display['filter_alle_l'] : "";
    $falu = isset($display['filter_alle_u']) ? $display['filter_alle_u'] : "100";
    $fsnl = isset($display['filter_snps_l']) ? $display['filter_snps_l'] : "";
    $fsnu = isset($display['filter_snps_u']) ? $display['filter_snps_u'] : "100";
    $fpal = isset($display['filter_pare_l']) ? $display['filter_pare_l'] : "";
    $fpau = isset($display['filter_pare_u']) ? $display['filter_pare_u'] : "1000";
    $ref = isset($display['filter_ref']) ? $display['filter_ref'] : "";
    $fch = isset($display['filter_chr']) ? $display['filter_chr'] : "";
    $fsb = isset($display['filter_sbp']) ? $display['filter_sbp'] : 0;
    $feb = isset($display['filter_ebp']) ? $display['filter_ebp'] : $max_chr_len;
    $flnl = isset($display['filter_lnl_l']) ? $display['filter_lnl_l'] : 0;
    $flnu = isset($display['filter_lnl_u']) ? $display['filter_lnl_u'] : -500;
    $r = range(1, 9);
    $r = array_merge($r, range(10, 100, 5));
    array_push($r, 1000);
    $alle_l_ctl = generate_element_select("filter_alle_l", $r, $fall, "");
    $alle_u_ctl = generate_element_select("filter_alle_u", $r, $falu, "");
    $snps_l_ctl = generate_element_select("filter_snps_l", $r, $fsnl, "");
    $snps_u_ctl = generate_element_select("filter_snps_u", $r, $fsnu, "");
    $r = range(1, 9);
    $r = array_merge($r, range(10, 500, 10));
    array_push($r, 1000, 2000, 10000);
    $pare_l_ctl = generate_element_select("filter_pare_l", $r, $fpal, "");
    $pare_u_ctl = generate_element_select("filter_pare_u", $r, $fpau, "");
    $chr_ctl = generate_element_select("filter_chr", $chrs, $fch, "");
    $sbp_ctl = generate_element_select("filter_sbp", range(0, $max_chr_len), $fsb, "");
    $ebp_ctl = generate_element_select("filter_ebp", range(0, $max_chr_len), $feb, "");
    $ref_ctl = generate_element_select("filter_ref", array("exon", "intron", "genomic"), $ref, "");
    $r = range(0, 9);
    $r = array_merge($r, range(10, 100, 5));
    $r = array_merge($r, range(200, 500, 100));
    for ($i = 0; $i < count($r); $i++) {
        $r[$i] = $r[$i] * -1;
    }
    $lnl_l_ctl = generate_element_select("filter_lnl_l", $r, $flnl, "");
    $lnl_u_ctl = generate_element_select("filter_lnl_u", $r, $flnu, "");
    if (isset($display['filter_type'])) {
        foreach ($filters as $key => $f) {
            if (in_array($key, $display['filter_type'])) {
                $filters[$key]['sel'] = "checked=\"checked\"";
                $filters[$key]['tr'] = "class=\"active_filter\"";
            } else {
                $filters[$key]['sel'] = "";
                $filters[$key]['tr'] = "";
            }
        }
    } else {
        $filters['none']['sel'] = "checked=\"checked\"";
    }
    echo <<<EOQ
<h4 class="info_head">
  <img id="stacks_filter_img" src="{$img_path}/caret-d.png" />
  <a onclick="toggle_div('stacks_filter', '{$img_path}', 'page_state');">Filter Results By</a>
</h4>
<div id="stacks_filter">
<form id="filter_results" name="filter_results" method="get" action="{$root_path}/catalog.php">
{$hidden_vars}

<table style="width: 100%; vertical-align: top;">
<tr>
EOQ;
    if (count($chrs) > 0) {
        echo <<<EOQ
<td style="width: 25%;">
<table class="loc_filter">
<tr>
  <td {$filters['loc']['tr']}>
      <input type="checkbox" name="filter_type[]" value="loc" onchange="rebuild_display_select()" {$filters['loc']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'loc')">
      <acronym title="Filter by genomic location">Location</acronym>:</a></td>
  <td {$filters['loc']['tr']}>
      {$chr_ctl}
  </td>
</tr>
<tr>
  <td {$filters['loc']['tr']}><span style="padding-left: 1.5em;">Start:</span></td>
  <td {$filters['loc']['tr']}>
      {$sbp_ctl} Mb
  </td>
</tr>
<tr>
  <td {$filters['loc']['tr']}><span style="padding-left: 1.5em;">End:</span></td>
  <td {$filters['loc']['tr']}>
      {$ebp_ctl} Mb
  </td>
</tr>
<tr>
  <td {$filters['ref']['tr']}>
      <input type="checkbox" name="filter_type[]" value="ref" onchange="rebuild_display_select()" {$filters['ref']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'ref')">
      <acronym title="Filter by type of RAD locus">Type</acronym>:</a></td>
  <td {$filters['ref']['tr']}>
      {$ref_ctl}
  </td>
</tr>
</table>
</td>

EOQ;
    }
    $cat_id_filter = isset($display['filter_cata']) ? $display['filter_cata'] : "";
    echo <<<EOQ
<td>
<table class="filter">
<tr>
  <td colspan="2" {$filters['cata']['tr']}>
      <input type="checkbox" name="filter_type[]" value="cata" onchange="rebuild_display_select()" {$filters['cata']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'cata')">
      <acronym title="Show a locus with a particular ID.">Catalog ID</acronym>:</a>
      <input name="filter_cata" value="{$cat_id_filter}" size="15" />
  </td>
  <td style="text-align: right; padding-right: 10px;">
      <input type="submit" value="filter" />
  </td>
</tr>
<tr>
  <td style="width: 40%; text-align: left;">
  <table style="text-align: left;">
  <tr>
  <td {$filters['alle']['tr']}>
      <input type="checkbox" name="filter_type[]" value="alle" onchange="rebuild_display_select()" {$filters['alle']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'alle')">
      <acronym title="Filter the catalog according to the number of alleles identified for a locus.">Alleles</acronym>:</a>
  </td>
  <td {$filters['alle']['tr']}>
{$alle_l_ctl} {$alle_u_ctl}
  </td>
  </tr>
  <tr>
  <td {$filters['snps']['tr']}>
      <input type="checkbox" name="filter_type[]" value="snps" onchange="rebuild_display_select()" {$filters['snps']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'snps')">
      <acronym title="Filter the catalog according to the number of SNPs found at a locus.">SNPs</acronym>:</a>
  </td>
  <td {$filters['snps']['tr']}>
{$snps_l_ctl} {$snps_u_ctl}
  </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </table>
  </td>

  <td style="width: 45%; text-align: center;">
  <table style="text-align: left;">
  <tr>
  <td {$filters['pare']['tr']}>
      <input type="checkbox" name="filter_type[]" value="pare" onchange="rebuild_display_select()" {$filters['pare']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'pare')">
      <acronym title="Filter the catalog according to the number of population samples that are matched to a locus.">Matching samples</acronym>:</a>
  </td>
  <td {$filters['pare']['tr']}>
{$pare_l_ctl} {$pare_u_ctl}
  </td>
  </tr>
  <tr>
<td {$filters['lnl']['tr']}>
      <input type="checkbox" name="filter_type[]" value="lnl" onchange="rebuild_display_select()" {$filters['lnl']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'lnl')">
      <acronym title="The mean log likelihood of each catalog locus.">LnL</acronym>:</a>
  </td>
  <td {$filters['lnl']['tr']}>
{$lnl_l_ctl} {$lnl_u_ctl}
  </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  </table>
  </td>

  <td style="width: 15%; text-align: right;">
  <table style="text-align: left;">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

EOQ;
    if ($cols['gcnt'] == true) {
        echo <<<EOQ
  <tr>
  <td {$filters['gcnt']['tr']}>
  <td {$filters['gcnt']['tr']}>
{$gcnt_ctl}
  </td>
  </tr>

EOQ;
    } else {
        echo <<<EOQ
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

EOQ;
    }
    echo <<<EOQ
  </table>
  </td>
</tr>

EOQ;
    if ($cols['seq'] == true) {
        echo <<<EOQ
<tr>
  <td {$filters['est']['tr']}>
      <input type="checkbox" name="filter_type[]" value="est" onchange="rebuild_display_select()" {$filters['est']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'est')">
      <acronym title="Filter the catalog to show loci for which ESTs have been associated.">Contains ESTs</acronym></a>
  </td>
  <td {$filters['pe']['tr']}>
      <input type="checkbox" name="filter_type[]" value="pe" onchange="rebuild_display_select()" {$filters['pe']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'pe')">
      <acronym title="Filter the catalog to show loci for which paired-end RAD-Tags have been associated.">Contains Paired-end RAD-Tags</acronym></a>
  </td>
  <td {$filters['blast']['tr']}>
      <input type="checkbox" name="filter_type[]" value="blast" onchange="rebuild_display_select()" {$filters['blast']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'blast')">
      <acronym title="Filter the catalog to show loci for which BLAST hits  have been associated.">Contains BLAST Hits</acronym></a>
  </td>
</tr>

EOQ;
    }
    echo <<<EOQ
</table>
</td>
</tr>
</table>
</form>
</div>

EOQ;
}
Esempio n. 2
0
function write_filter()
{
    global $img_path, $root_path, $display;
    $hidden_vars = generate_hidden_form_vars("filter");
    $filters = array("depth" => array(), "snps" => array(), "tagid" => array(), "black" => array(), "delv" => array(), "rem" => array());
    $ele_name = isset($display['filter_depth']) ? $display['filter_depth'] : "";
    $depth_ctl = generate_element_select("filter_depth", array(1, 5, 10, 20), $ele_name, "");
    $ele_name = isset($display['filter_snps']) ? $display['filter_snps'] : "";
    $snps_ctl = generate_element_select("filter_snps", array(1, 2, 3, 4, 5), $ele_name, "");
    $ele_name = isset($display['filter_delv']) ? $display['filter_delv'] : "";
    $delv_ctl = generate_key_element_select("filter_delv", array(1 => "True", 0 => "False"), $ele_name, "");
    $ele_name = isset($display['filter_rem']) ? $display['filter_rem'] : "";
    $rem_ctl = generate_key_element_select("filter_rem", array(1 => "True", 0 => "False"), $ele_name, "");
    $ele_name = isset($display['filter_black']) ? $display['filter_black'] : "";
    $black_ctl = generate_key_element_select("filter_black", array(1 => "True", 0 => "False"), $ele_name, "");
    if (isset($display['filter_type'])) {
        foreach ($filters as $key => $f) {
            if (in_array($key, $display['filter_type'])) {
                $filters[$key]['sel'] = "checked=\"checked\"";
                $filters[$key]['tr'] = "class=\"active_filter\"";
            } else {
                $filters[$key]['sel'] = "";
                $filters[$key]['tr'] = "";
            }
        }
    } else {
        $filters['none']['sel'] = "checked=\"checked\"";
    }
    $tagid = isset($display['filter_tagid']) ? $display['filter_tagid'] : "";
    echo <<<EOQ
<h4 class="info_head">
  <img id="filter_img" src="{$img_path}/caret-d.png" />
  <a onclick="toggle_div('filter', '{$img_path}', 'page_state');">Filter Results</a>
</h4>
<div class="filter">
<form id="filter_results" name="filter_results" method="get" action="{$root_path}/tags.php">
{$hidden_vars}
<table class="filter">
<tr {$filters['tagid']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="tagid" onchange="rebuild_display_select()" {$filters['tagid']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'tagid')">Filter by Tag ID:</a></td>
  <td>
    <input name="filter_tagid" value="{$tagid}" size="15" />
  </td>
</tr>
<tr {$filters['depth']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="depth" onchange="rebuild_display_select()" {$filters['depth']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'depth')">Filter by depth of coverage:</a></td>
  <td>
{$depth_ctl}
  </td>
</tr>
<tr {$filters['snps']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="snps" onchange="rebuild_display_select()" {$filters['snps']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'snps')">Filter by presence of SNPs:</a></td>
  <td>
{$snps_ctl}
  </td>
</tr>
<tr {$filters['delv']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="delv" onchange="rebuild_display_select()" {$filters['delv']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'delv')">View deleveraged tags:</a></td>
  <td>
{$delv_ctl}
  </td>
</tr>
<tr {$filters['black']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="black" onchange="rebuild_display_select()" {$filters['black']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'black')">View blacklisted tags:</a></td>
  <td>
{$black_ctl}
  </td>
</tr>
<tr {$filters['rem']['tr']}>
  <td><input type="checkbox" name="filter_type[]" value="rem" onchange="rebuild_display_select()" {$filters['rem']['sel']} /> 
      <a onclick="toggle_cb('filter_results', 'rem')">View lumberjack stacks:</a></td>
  <td>
{$rem_ctl}
  </td>
</tr>
<tr>
  <td colspan="2" style="text-align: right; padding-right: 10px;">
    <input type="submit" value="filter" onclick="update_page_state_form(this.form.id, 'page_state')" />
  </td>
</tr>
</table>
</form>
</div>

EOQ;
}