$sql = "SELECT gene_id,domain_acc,species FROM gene2domain WHERE gene_id IN ({$id_search_string}) AND domain_db='{$domain_type}'"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { $gene_id = $row['gene_id']; $domain_acc = $row['domain_acc']; if (isset($data[$gene_id][$domain_acc])) { $data[$gene_id][$domain_acc]++; } else { $data[$gene_id][$domain_acc] = 1; } if (isset($number[$gene_id])) { $number[$gene_id]++; } else { $number[$gene_id] = 1; } $species[$gene_id] = species_name_change($row['species']); } $total_num = count($data); require 'analysis_count_num.php'; ?> <h3>Domains in Database <?php echo $domain_type; ?> </h3> <div class="table-responsive"> <div id="final_toolbar"> <button id="select2analysis_btn" class="btn btn-primary" disabled>Select & Re-Analysis</button> <button id="select2blast_btn" class="btn btn-success" disabled>Select & BLAST</button> <button id="select2tree_btn" class="btn btn-warning" disabled>Select & Phylogenetic Tree Build</button>
<?php // Species $sql = "SELECT id,species FROM gene_info WHERE id IN ({$id_search_string})"; $query = $connect->query($sql); $data = array(); while ($row = $query->fetch_array()) { $gene_id = $row['id']; $data[$gene_id]['species'] = species_name_change($row['species']); } // Transcript/CDS Length $sql = "SELECT gene_id,transcript_length,CDS_length FROM transcript_info WHERE gene_id IN ({$id_search_string}) AND principle='Y'"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { $gene_id = $row['gene_id']; $data[$gene_id]['transcript_length'] = $row['transcript_length']; $data[$gene_id]['CDS_length'] = isset($row['CDS_length']) ? $row['CDS_length'] : '<i>NA</i>'; } $sql = "SELECT gene_id,GC_content FROM cds_statistics WHERE gene_id IN ({$id_search_string})"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { $gene_id = $row['gene_id']; $data[$gene_id]['GC_content'] = isset($row['GC_content']) ? $row['GC_content'] : '<abbr data-toggle="tooltip" title="Not Available"><i>NA</i></abbr>'; } // Exon/Intron Length $sql = "SELECT gene_id,type,COUNT(type) AS type_num, SUM(length) AS sum_length FROM exon_intron_structure\n WHERE gene_id IN ({$id_search_string}) AND type='intron' GROUP BY gene_id,type"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { $gene_id = $row['gene_id']; $data[$gene_id]['sum_length_intron'] = $row['sum_length']; $data[$gene_id]['num_intron'] = $row['type_num'];
} } // gene id(s) -> gene name, species(s) (Print table) $protein_id_array = array_unique($protein_id_array); $gene_id_array = array_unique($gene_id_array); $sql = "SELECT id, species, name FROM gene_info WHERE id IN (" . implode(', ', $gene_id_array) . ")"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { $gene_id = $row['id']; $data[$gene_id]['name'] = $row['name']; $data[$gene_id]['species'] = $row['species']; } foreach ($protein_id_array as $protein_id) { $gene_id = preg_replace('/\\.\\d+$/', '', $protein_id); $gene_name = $data[$gene_id]['name']; $output_species = species_name_change($data[$gene_id]['species']); $output_go = ''; foreach (array_keys($data[$protein_id]) as $acc) { $output_go .= $acc . ';'; } $output_data[] = array('id' => $protein_id, 'name' => $gene_name, 'species' => $output_species, 'go' => $output_go); } file_put_contents($tmp_file, json_encode($output_data)); ?> <div class="table-responsive"> <div id="final_toolbar"> <button id="select2analysis_btn" class="btn btn-primary" disabled>Select & Analysis</button> <button id="select2blast_btn" class="btn btn-success" disabled>Select & BLAST</button> <button id="select2tree_btn" class="btn btn-warning" disabled>Select & Phylogenetic Tree Build</button> <button id="select2store_btn" class="btn btn-default" disabled>Select & Store</button>
<?php } ?> </tr> </thead> <tbody> <?php foreach ($id_array as $input_id) { echo '<tr>'; if (isset($data[$input_id])) { echo '<td></td>'; $valid_id_array[] = $input_id; // used for drawing chart echo '<td>', $input_id, '</td>'; echo '<td><a target="_blank" data-toggle="tooltip" title="Open in new window" href="/profiles/transcript/', $input_id, '.1/expression">', $input_id, '.1</a></td>'; echo '<td><i>', species_name_change($species), '</i></td>'; foreach ($sample_array as $sample) { echo '<td>'; echo number_format($data[$input_id][$sample], 2); echo '</td>'; } } else { echo '<td></td><td>', $input_id, '</td>', str_repeat('<td><abbr data-toggle="tooltip" title="Not Available"><i>NA</i></abbr></td>', count($sample_array) + 2); } echo '</tr>'; } ?> </tbody> </table> </div>
" class="panel-collapse collapse <?php if ($species == 'Ghir') { echo 'in'; } ?> " role="tabpanel"> <div class="panel-body"> <?php foreach (array_keys($data[$species]) as $fieldset) { ?> <fieldset class="fieldset_express_fpkm"> <legend style="font-size:120%"><?php echo $fieldset; ?> (<i><?php echo species_name_change($species); ?> </i>) </legend> <div class="row"><input type="checkbox" class="check-control-all" /> <span class="bg-primary">Check All</span></div> <?php foreach (array_keys($data[$species][$fieldset]) as $category) { ?> <div class="row has-feedback"> <div class="checkbox"> <?php $sample_array = array_keys($data[$species][$fieldset][$category]); sort($sample_array); foreach ($sample_array as $sample) { ?> <label class="col-md-<?php
$target_tax = $_POST['target_tax']; $id_search_string = preg_replace("/',/", ".1',", $id_search_string); $id_search_string = preg_replace("/'\$/", ".1'", $id_search_string); $sql = "SELECT * FROM ortholog WHERE queryID IN ({$id_search_string}) AND subjectType='{$target_tax}'"; $data = array(); $query = $connect->query($sql); while ($row = $query->fetch_array()) { $query_id = $row['queryID']; $query_id = preg_replace('/\\.\\d+$/', '', $query_id); $subject_id = $row['subjectID']; $data[$query_id][$subject_id]['queryLen'] = $row['queryLen']; $data[$query_id][$subject_id]['subjectLen'] = $row['subjectLen']; $data[$query_id][$subject_id]['queryCov'] = $row['queryCov']; $data[$query_id][$subject_id]['e_value'] = $row['e_value']; $data[$query_id][$subject_id]['identity'] = $row['identity']; $species[$query_id] = species_name_change($row['queryType']); } $total_num = count($data); require 'analysis_count_num.php'; ?> <h3 id="target_tax_head"></h3> <script> var tax = $('#target_tax').find("option:selected").text(); $('#target_tax_head').html('Target Species: '+tax); </script> <div class="table-responsive"> <div id="final_toolbar"> <button id="select2analysis_btn" class="btn btn-primary" disabled>Select & Re-Analysis</button> <button id="select2blast_btn" class="btn btn-success" disabled>Select & BLAST</button> <button id="select2tree_btn" class="btn btn-warning" disabled>Select & Phylogenetic Tree Build</button>
<?php require '../phpInclude/function_species_name_change.php'; // short species name => full name // connect database require '../phpInclude/connect_db.php'; $query_id = $_POST['query_id']; $hit_id = preg_replace('/\\.\\d+$/', '', $_POST['hit_id']); $score = $_POST['score']; $sql = "SELECT id,species,name,description,chromosome FROM gene_info WHERE id='{$hit_id}'"; $query = $connect->query($sql); while ($row = $query->fetch_array()) { echo json_encode(array('query_id' => $query_id, 'hit_id' => $_POST['hit_id'], 'score' => $score, 'name' => $row['name'], 'desc' => $row['description'], 'species' => species_name_change($row['species']), 'chr' => $row['chromosome'])); }
<th data-field="id" data-sortable="true" data-formatter="IDFormatter">Gene ID</th> <th data-sortable="true">Gene Name</th> <th>Description</th> <th>Start</th> <th>End</th> <th>Strand</th> <th>Links</th> </tr> </thead> <tbody> <?php while ($row = $query->fetch_array()) { $gene_id = $row['id']; $gene_name = isset($row['name']) ? $row['name'] : '<abbr data-toggle="tooltip" title="Not Available"><i>NA</i></abbr>'; $desc = isset($row['description']) ? $row['description'] : '<abbr data-toggle="tooltip" title="Not Available"><i>NA</i></abbr>'; $output_species = species_name_change($row['species']); echo '<tr>'; echo '<td></td>'; echo '<td>', $gene_id, '</td>'; echo '<td>', $gene_name, '</td>'; echo '<td>', $desc, '</td>'; echo '<td>', number_format($row['start']), '</td>'; echo '<td>', number_format($row['end']), '</td>'; echo '<td>', $row['strand'], '</td>'; // Link to different databases echo '<td>'; echo '<a target="_blank" data-toggle="tooltip" title="Exon-Intron Structure" href="/profiles/transcript/', $gene_id, '.1/structure"><small>Structure</small></a>; '; echo '<a target="_blank" data-toggle="tooltip" title="Protein Domain" href="/profiles/transcript/', $gene_id, '.1/domain"><small>Domain</small></a>; '; echo '<a target="_blank" data-toggle="tooltip" title="Homologous Genes in Intra/Inter Species" href="/profiles/transcript/', $gene_id, '.1/ortholog"><small>Homology</small></a>; '; echo '<a target="_blank" data-toggle="tooltip" title="Gene Ontology Annotation" href="/profiles/transcript/', $gene_id, '.1/go"><small>GO</small></a>; '; echo '<a target="_blank" data-toggle="tooltip" title="KEGG Pathway Annotation" href="/profiles/transcript/', $gene_id, '.1/kegg"><small>Pathway</small></a>; ';
$sql_restrict = "id='{$search_info}' OR "; if (preg_match('/[^\\w\\s\\-]/', $search_info)) { $sql_restrict .= "name LIKE '%" . addslashes($search_info) . "%' OR description LIKE '%" . addslashes($search_info) . "%'"; } else { $sql_restrict .= "name LIKE '%{$search_info}%' OR description REGEXP '[[:<:]]" . $search_info . "[[:>:]]'"; } $sql_restrict = "({$sql_restrict}) AND species='{$species}'"; // count number $sql = "SELECT * FROM gene_info WHERE {$sql_restrict}"; $tmp_file = '../tmp/' . uniqid('search-', true); $query = $connect->query($sql); $total_num = $query->num_rows; require 'search_count_num.php'; // get search results and group to JSON while ($row = $query->fetch_array()) { $output_data[] = array('id' => $row['id'], 'name' => $row['name'], 'desc' => $row['description'], 'species' => species_name_change($row['species']), 'chromosome' => $row['chromosome'], 'start' => $row['start'], 'end' => $row['end'], 'strand' => $row['strand']); } file_put_contents($tmp_file, json_encode($output_data)); ?> <div class="table-responsive"> <div id="final_toolbar"> <button id="select2analysis_btn" class="btn btn-primary" disabled>Select & Analysis</button> <button id="select2blast_btn" class="btn btn-success" disabled>Select & BLAST</button> <button id="select2tree_btn" class="btn btn-warning" disabled>Select & Phylogenetic Tree Build</button> <button id="select2store_btn" class="btn btn-default" disabled>Select & Store</button> </div> <table data-toggle="table" class="table table-hover table-no-bordered bootstrap-table-responsive" data-toolbar="#final_toolbar" id="final_table" data-search="true" data-escape="false" data-url="../phpInclude/bootstrap_table_server_pagination.php" data-show-refresh="true" data-show-export="true" data-export-types="['txt', 'csv', 'excel']" data-export-data-type="all"