query($_sql); $_dom_result = $_link->query($_dom_sql); $_mu_result = $_link->query($_mu_sql); $_str_result = $_link->query($_str_sql); $_repi_result = $_link->query($_repi_sql); ?>
"; // echo "
  • Function
  • "; if (count(mysqli_fetch_array($_mu_result)) > 0) { echo "
  • Mutation
  • "; } // echo "
  • Domains&Motif
  • "; echo "
  • Sequence
  • "; // if (count(mysqli_fetch_array($_str_result)) > 0) { // echo "
  • Structure
  • "; // } if (count(mysqli_fetch_array($_repi_result)) > 0) { echo "
  • Epitope
  • "; } echo ""; ?>
    //查詢main表數據 $_result = $_link->query($_sql); $_assoc = $_result->fetch_assoc(); $_NC = $_assoc['h_NC']; $_uni = $_assoc['h_uni']; $_protein = $_assoc['h_protein']; $_type = $_assoc['h_type']; $_hid = $_assoc['h_hid']; echo "

    " . $_type . " " . $_protein . "

    "; echo "
    Accession: $_hid
    "; if ($_NC) { echo "
    NC: $_NC
    "; } if ($_uni) { echo "
    Uniprot: $_uni
    "; } echo "
    Protein: " . $_assoc['h_protein'] . "
    "; echo "
    Organism: " . $_assoc['h_organism'] . "
    "; echo ""; // echo '

    Function

    '; echo "

    " . $_assoc['h_function'] . '

    '; // echo '

    Mutation

    '; echo "
    "; //获得开始的值 除以100,向上取整,再乘以100,得到最近且大的整百数赋值给$_e $_start = $_assoc['h_start']; $_end = $_assoc['h_end']; $_e = ceil($_start / 100) * 100; $_i = 0;//设置循环变量 while ($_e < $_end) { echo "
    "; if ($_i == 0) { //第一条数据 $_s = $_start; } elseif (floor($_e / 100) == floor($_end / 100)) { $_s = $_e + 1; $_e = $_end;//最后一条 } else { $_s = $_e + 1; $_e = $_e + 100; } echo "$_s-$_e"; //绘制线条 echo '
    '; echo '
    '; //绘制灰色背景 $_l = $_e - $_s + 1;//计算灰色背景的长度 //打印灰色背景 echo "
    "; for ($_type = 0; $_type < 4; $_type++) { //绘制数据点 $_o = 0;//设置变量 $_position = 0;//初始化position变量 echo "
    "; //查詢mutaitons表數據 $_mu_result = $_link->query($_mu_sql); //遍历mutations表中对应的数据 while ($_assoc = mysqli_fetch_assoc($_mu_result)) { //若当前突变位置在对应的区间以内 if (($_assoc['h_mu_position'] <= $_e) && ($_assoc['h_mu_position']) >= $_s) { // echo $_assoc['h_mu_position']; //判断颜色与位置 if ($_type == $_assoc['h_mu_type']) { //计算宽度 if ($_o == 0) { //如果是第一个数据 $_width = (($_assoc['h_mu_position'] - $_s) / ($_e - $_s) * 100); echo "
    "; } elseif ($_assoc['h_mu_position'] == $_position) { //如果后一个位置与前一个位置相同,不执行任何动作 } else { $_width = (($_assoc['h_mu_position'] - $_position) / ($_e - $_s) * 100); echo "
    "; } $_o = $_o + 1; $_position = $_assoc['h_mu_position'];//记录当前的position } } } echo '
    '; } $_i = $_i + 1; echo '
    '; echo '
    '; echo '
    '; } echo '
    '; echo '
    '; echo 'Legend:'; echo 'same sense'; echo 'missense'; echo 'insertion'; echo 'deletion'; echo '
    '; //查詢mutations中復合條件的數據的數量 $_count = mysqli_num_rows($_mu_result); //将数据数量分为三组 if ($_count % 2 == 0) { $_count = floor($_count / 2); } else if ($_count % 2 < 3) { $_count = floor($_count / 2 + 1); } else if ($_count % 2 < 5) { $_count = floor($_count / 2 + 2); } else if ($_count % 2 < 7) { $_count = floor($_count / 2 + 3); } echo 'show more details'; echo ''; } ?>

    Sequence&Mutation

    '; //从main表中读取数据 $_result = $_link->query($_sql); $_assoc = mysqli_fetch_assoc($_result); $_seq_dna = $_assoc['h_seq_DNA']; $_seq_aa = $_assoc['h_seq_AA']; echo '
    ';
                    if ($_seq_dna != null) {//如果表里包含有dna的数据,就对照显示,如果没有就只显示氨基酸
                        $_ar_dna = array();
                        $_ar_aa = array();
                        $_start = $_assoc['h_start'];
                        $_end = $_assoc['h_end'];
                        $_mu_position = 0;
                        $_now_aa = 0;
                        //t表示總共的行數
                        for ($_t = 0; $_t < ceil(strlen($_seq_dna) / 60); $_t++) {
    
                            //输出计数的点号
                            //如果是最后一行
                            if ($_t == ceil(strlen($_seq_dna) / 60) - 1) {
                                for ($_i = 0; $_i < 6; $_i++) {
                                    if ($_i <= strlen($_seq_dna) % 60 / 10 - 1) {
                                        echo '         .';
                                    } else {
                                        echo '          ';
                                    }
                                }
                            } else {
                                for ($_i = 0; $_i < 6; $_i++) {
                                    echo '         .';
                                }
                            }
    
                            //输出最后一个碱基在全基因中的位置
                            $_num_G = $_start + 60 * ($_t + 1) - 1;
                            if ($_num_G > $_end) {
                                echo '     G:' . $_end;
                            } else {
                                echo '     G:' . $_num_G;
                            }
                            echo '
    '; //输出DNA序列 for ($_i = 0; $_i < 60; $_i++) { if ($_t != 0) { $_a = 0; //其他行,$_i從60的$_t倍開始 $_ar_dna[] = substr($_seq_dna, $_t * 60 + $_i, 1); //遍历mutation数据 $_mu_result = $_link->query($_mu_sql); while ($_assoc = mysqli_fetch_assoc($_mu_result)) { if ($_assoc['h_is_same'] == 1) { if ($_assoc['h_mu_position'] == $_t * 60 + $_i + $_start && $_assoc['h_mu_position'] != $_mu_position) { echo ''; echo $_ar_dna[$_t * 60 + $_i]; echo ''; $_a = 1; } $_mu_position = $_assoc['h_mu_position'];//记录当前索引位置 } } if ($_a == 0) { echo $_ar_dna[$_t * 60 + $_i]; } if ($_ar_dna[$_t * 60 + $_i] == '') { echo ' '; } } else { $_a = 0; //第一行,$_i從0開始 $_ar_dna[] = substr($_seq_dna, $_i, 1); //遍历mutation数据& $_mu_result = $_link->query($_mu_sql); while ($_assoc = mysqli_fetch_assoc($_mu_result)) { if ($_assoc['h_is_same'] == 1) { if ($_assoc['h_mu_position'] == $_i + $_start && $_assoc['h_mu_position'] != $_mu_position) { echo ''; echo $_ar_dna[$_i]; echo ''; $_a = 1; } $_mu_position = $_assoc['h_mu_position'];//记录当前索引位置 } } if ($_a == 0) { echo $_ar_dna[$_i]; } } } //输出当前行碱基的数量 如果是最后一行 if ($_t == ceil(strlen($_seq_dna) / 60) - 1) { echo '     C:' . strlen($_seq_dna) % 60; } else { echo '     C:60'; } echo '
    '; //输出氨基酸序列 for ($_i = 0; $_i < 20; $_i++) { if ($_t == 0) { $_a = 0; //如果是第一行 $_ar_aa[] = substr($_seq_aa, $_i, 1); //遍历出所有的错义,插入,删除mutations数据 $_mu_result = $_link->query($_mu_sql); while ($_assoc = mysqli_fetch_assoc($_mu_result)) { if ($_assoc['h_is_same'] == 1) { //若该突变所选的标准株与所示的标准株序列相同 if ($_assoc['h_mu_type'] != 0 && $_assoc['h_mu_type'] != 2) { //将错义,删除的位置取出 107 133 135 $_mu_position = $_assoc['h_mu_position']; // echo $_mu_position; //记录碱基突变所对应的氨基酸突变位置 8 17 18 $_aa_position = intval(($_mu_position - $_start) / 3); //将突变的氨基酸设置背景颜色 if ($_aa_position == $_i && $_now_aa != $_aa_position) { echo ' ' . $_ar_aa[$_i] . ' '; $_a = 1; } //记录当前氨基酸突变的位置 $_now_aa = $_aa_position; } } } if ($_a == 0) { echo ' ' . $_ar_aa[$_i] . ' '; } } else { $_a = 0; //如果不是第一行 $_ar_aa[] = substr($_seq_aa, $_t * 20 + $_i, 1); $_mu_result = $_link->query($_mu_sql); while ($_assoc = mysqli_fetch_assoc($_mu_result)) { if ($_assoc['h_is_same'] == 1) { //若该突变所选的标准株与所示序列相同 if ($_assoc['h_mu_type'] != 0 && $_assoc['h_mu_type'] != 2) { //将错义,删除的位置取出 // echo $_assoc['h_mu_position']; $_aa_position = intval(($_assoc['h_mu_position'] - $_start) / 3); if ($_aa_position == $_t * 20 + $_i && $_now_aa != $_aa_position) { echo ' ' . $_ar_aa[$_t * 20 + $_i] . ' '; $_a = 1; } $_now_aa = $_aa_position; } } } // echo ' ' . $_ar_aa[$_t*20+$_i] . ' '; if ($_a == 0) { echo ' ' . $_ar_aa[$_t * 20 + $_i] . ' '; } if ($_ar_aa[$_t * 20 + $_i] == '') { echo ' '; } } } //输出当前航氨基酸的数量 如果是最后一行 if ($_t == ceil(strlen($_seq_dna) / 60) - 1) { echo '     P:' . strlen($_seq_aa) % 20; } else { echo '     P:20'; } echo '
    '; echo '
    '; echo '
    '; } } else { //如果不包含dna的数据,就只显示氨基酸 $row = ceil(strlen($_seq_aa) / 60); $_aa_arr = []; for ($i = 0; $i < strlen($_seq_aa); $i++) { $_aa_arr[] = substr($_seq_aa, $i, 1); } for ($r = 0; $r < $row; $r++) { for ($i = 1; $i <= 60; $i++) { $pos = $i + (60 * $r); if ($i % 10 == 0 && $pos < strlen($_seq_aa)) { echo '.'; } else { echo ' '; } } echo '
    '; for ($i = 0; $i < 60; $i++) { if ($i % 10 == 0 && $i != 0) { echo ' '; } else { $pos = $i + (60 * $r); if ($pos < strlen($_seq_aa)) { echo $_aa_arr[$pos]; } } } echo '
    '; } // echo '
    '.$_seq_aa; } echo '
    '; echo '
    '; $_count = 0; $_mu_result = $_link->query($_mu_sql); while ($_assoc = mysqli_fetch_assoc($_mu_result)) { $_is_same = $_assoc['h_is_same']; if ($_is_same == 1) { $_count += 1; } } if ($_count != 0) { echo '
    '; echo 'Legend:'; echo 'gene mutation'; echo 'amino acid mutation'; echo '
    '; echo '

    '; } ?> "; //如果存在表位数据 if (count(mysqli_fetch_array($_repi_result)) > 0) { echo ''; echo '

    Epitope&Mutation

    '; echo '
    '; echo 'Legend:'; echo 'mutation'; echo 'epitope'; echo '
    '; echo '
    ';
                        echo '>' . $_hid . '_' . $_protein . '
    '; //先打印一条氨基酸序列,在上面标注出免疫表位和突变位点 for ($i = 1; $i <= strlen($_seq_aa); $i++) { //把序列放在数组中 $_aa_arr[] = substr($_seq_aa, $i - 1, 1); $em = 0; $_repi_result = $_link->query($_repi_sql); $_mu_result = $_link->query($_mu_sql);//读突变数据 while ($_assoc = mysqli_fetch_assoc($_repi_result)) { $_pos_start = $_assoc['h_pos_start']; $_pos_end = $_assoc['h_pos_end']; while ($_assoc = mysqli_fetch_assoc($_mu_result)) {//循环突变数据 $_aa_position = $_assoc['h_aa_position']; if ($_aa_position == $i && $em != 1) { echo ''; echo $_aa_arr[$i - 1] . ''; $em = 1; } } if ($_pos_start <= $i && $_pos_end >= $i && $em != 1) { echo '' . $_aa_arr[$i - 1] . ''; $em = 1; } } if ($em == 0) { echo $_aa_arr[$i - 1]; } } echo '
    '; //序列下面显示表位信息 $_repi_result = $_link->query($_repi_sql); while ($_assoc = mysqli_fetch_assoc($_repi_result)) { $_start = $_assoc['h_pos_start'];//表位的起始位置 $_end = $_assoc['h_pos_end'];//表位的结束位置 $_id = $_assoc['h_epiid'];//表位的id号 $_allele = $_assoc['h_allele']; $_len_al = strlen($_allele); $_print = 0;//未打印过序列 for ($i = 1; $i <= strlen($_seq_aa); $i++) { if ($i < $_start || $i > $_end + $_len_al + 2) { echo '·'; } else { if ($_print == 0) { echo "" . $_assoc['h_seq'] . '(' . $_allele . ')'; $_print = 1;//打印过序列 } } } echo '
    '; } echo '
    '; } ?>

    0) { // echo ''; // echo '

    Structure&Mutation

    '; // $_dom_result = $_link->query($_dom_sql); // $_assoc = $_dom_result->fetch_assoc(); // $_start = $_assoc['h_start']; // $_end = $_assoc['h_end']; // //获取main里面的id // $_id = $_assoc['h_id']; // $_main_type = $_assoc['h_type']; // echo "
    "; // // //绘制背景 // //从数据库中读取structure的数据 // $_str_result = $_link->query($_str_sql); // //遍历structure中的数据 // $_i = 1; // $_n_start = 0; // $_n_end = 0; // //计算数据表中复合条件的数据数量 // $_count = mysqli_num_rows($_str_result); // while ($_assoc = mysqli_fetch_assoc($_str_result)) { // // $_key = $_assoc['h_feature_key'];//取出该条数据中的折叠类型 // $_pos_start = $_assoc['h_pos_start']; // $_pos_end = $_assoc['h_pos_end'];//取出该条数据中的起始结束位置 // // //$_S和$_e为灰色背景的起始位置和结束位置 // if ($_i == 1) { // //输出起始位置 // $_s = $_start; // $_e = $_pos_start; // } else { // $_s = $_n_end; // $_e = $_pos_start; // } // $_width = ($_e - $_s) / ($_end - $_start) * 100; // // echo "
    "; // if ($_i == 1 && $_width >= 1) { // echo "$_start"; // } // echo "
    "; // //绘制折叠类型图形 // $_k_width = ($_pos_end - $_pos_start) / ($_end - $_start) * 100; // echo "
    "; // if ($_i == 1 && $_width < 1) { // echo "$_start"; // } // echo "
    "; // // $_i = $_i + 1; // $_n_start = $_pos_start;// 将当前的起始位置和结束位置进行赋值 // $_n_end = $_pos_end; // // } // $_width = ($_end - $_n_end) / ($_end - $_start) * 100; // echo "
    "; // echo "$_end"; // echo "
    "; // // // 绘制突变位置的小圆点 // // 从mutations表中读取数据 // $_mu_result = $_link->query($_mu_sql); // // 遍历数据 // while ($_assoc = mysqli_fetch_assoc($_mu_result)) { // $_mu_position = $_assoc['h_mu_position']; // if ($_mu_position >= $_start && $_mu_position <= $_end) { // $_left = ($_mu_position - $_start + 1) / ($_end - $_start + 1) * 100; // echo ""; // } // // } // echo '
    '; // // //legends // echo "
    "; // echo "Legend:"; // echo "Helix"; // echo "Turn"; // echo "Beta strand"; // echo "Mutation"; // echo '
    '; // // //表格 // echo '
    '; // echo ''; // //打印表头 // echo ''; // echo ''; // echo ''; // //遍历structure表 // $_str_result = $_link->query($_str_sql); // while ($_assoc = mysqli_fetch_assoc($_str_result)) { // $_key = $_assoc['h_feature_key']; // $_pos_start = $_assoc['h_pos_start']; // $_pos_end = $_assoc['h_pos_end']; // echo ''; // echo ''; // echo ''; // echo ''; // echo ''; // } // echo '
    Feature keyPosition(s)Lengthgraphical view
    ' . $_key . '' . $_pos_start . '-' . $_pos_end . '' . $_assoc['h_length'] . ''; // echo '
    '; // $_left = ($_pos_start - $_start) / ($_end - $_start) * 100; // $_right = ($_end - $_pos_end) / ($_end - $_start) * 100; // if ($_key == 'Turn') { // echo "
    "; // } else if ($_key == 'Helix') { // echo "
    "; // } else { // echo "
    "; // } // echo '
    '; // } // ?>