Ignore:
Timestamp:
09/08/09 17:54:13 (15 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter/db
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/db/builddatasets.php

    r9498 r9505  
    7878                    if ($_SESSION[$key]=="On")
    7979                        if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff")
    80                             if (!(ereg("^[0-9]*ON$", $key) || ereg("^[0-9]*Off$", $key)))
     80                            if (!(ereg("^DSSeq[0-9]*$", $key)))
    8181                                if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
    8282                                    $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
     
    9494                $query0 .= GetJoin($fromtable,$key);
    9595
    96         if ($_SESSION["DisplaySelected"]!="yes" || ($_SESSION["sequon"]==" " && $_SESSION["sequoff"]==" "))
     96        if ($_SESSION["DisplaySelected"]!="yes"
     97            || ($_SESSION["sequon"]==" " && $_SESSION["sequoff"]==" "))
    9798        {
    9899            if ($_SESSION["fTest"]!="On")
     
    199200                $starstop=substr($_SESSION["fStarStop"], 0, 10);
    200201                $query0 .= " fStar < '" . $starstop . " 23:59:59' ";
     202            }
     203
     204            if ($_SESSION["DisplaySelected"]=="inverse")
     205            {
     206                $displsequ=str_replace("  ", " ", $_SESSION["sequon"].$_SESSION["sequoff"]);
     207                $displsequ=ereg_replace("^ ", "(", $displsequ);
     208                $displsequ=ereg_replace("$", ")", $displsequ);
     209                $displsequ=str_replace(" ",  ",", $displsequ);
     210
     211                if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
     212                    $query0 .= " AND ";
     213
     214                $query0 .= " fSequenceFirst NOT IN " . $displsequ;
    201215            }
    202216
     
    232246            $displsequ=str_replace("  ", " ", $_SESSION["sequon"].$_SESSION["sequoff"]);
    233247            $displsequ=ereg_replace("^ ", "(", $displsequ);
    234             $displsequ=ereg_replace(" $", ")", $displsequ);
     248            $displsequ=ereg_replace("$", ")", $displsequ);
    235249            $displsequ=str_replace(" ",  ",", $displsequ);
    236250
     
    395409                PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $result1, "yes");
    396410
    397                 if ($_SESSION["sequon"]!=" " || $_SESSION["sequoff"]!=" ")
     411                if (!(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])))
    398412                {
    399413                    printf("<div align='left'>\n");
    400414                    printf("Remark: To store your selection you have to press 'Update Data Set'<br> \n");
    401                     if ($_SESSION["DisplaySelected"]!="yes" && ($_SESSION["sequon"]!=" " || $_SESSION["sequoff"]!=" "))
    402                     {
    403                         printf("Remark: To be able to remove sequence(s) from your selection you have to \n");
    404                         printf("'Display Selected Sequences'");
    405 //                        printf("<input type='button' value='Display Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=yes\"'>\n", GetClearedURL("yes"));
    406                         printf(" only.<br>\n");
    407                     }
    408415                    printf("<br>\n");
    409416
     
    412419                    $on=str_replace(" ", ",", trim($_SESSION["sequon"]));
    413420                    $off=str_replace(" ", ",", trim($_SESSION["sequoff"]));
     421
     422                    //set observation mode
     423                    if ($_SESSION["sequoff"]==" ")
     424                        $obsmode="Wobble";
     425                    else
     426                        $obsmode="On";
     427
     428                    //get key from db for insert query
     429                    $query   = "SELECT fObservationModeKEY FROM ObservationMode WHERE fObservationModeName='".$obsmode."'";
     430                    $result  = mysql_query($query);
     431                    $row = mysql_fetch_assoc($result);
     432                    $_SESSION["obsmode"] = $row["fObservationModeKEY"];
     433                    mysql_free_result($result);
    414434
    415435                    $values=array("Sum(fRunTime)/60"         => $runtime,
     
    555575
    556576                            if ($values["Min(fNumStarsCorMed)"][$val]<$numstarscorlimit)
    557                                 printf("<li style='color:%s'>%s: One of your %s-sequences has less than %s correlated stars (%s). </li>\n",
     577                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has less than %s correlated stars (%s). </li>\n",
    558578                                       $color["WARN"], "WARN", $val, $numstarscorlimit, $values["Min(fNumStarsCorMed)"][$val]);
    559579                            if ($values["Min(fNumStarsMed)"][$val]<$numstarslimit)
    560                                 printf("<li style='color:%s'>%s: One of your %s-sequences has less than %s identified stars (%s). </li>\n",
     580                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has less than %s identified stars (%s). </li>\n",
    561581                                       $color["WARN"], "WARN", $val, $numstarslimit, $values["Min(fNumStarsMed)"][$val]);
    562582                            if ($values["Min(fRunTime)/60"][$val]<$runtimelimit)
    563                                 printf("<li style='color:%s'>%s: One of your %s-sequences is shorter than %s min (%s min). </li>\n",
     583                                printf("<li style='color:%s'>%s: At least one of your %s-sequences is shorter than %s min (%s min). </li>\n",
    564584                                       $color["INFO"], "INFO", $val, $runtimelimit, $values["Min(fRunTime)/60"][$val]);
    565585                            if ($values["Max(fInhomogeneity)"][$val]>$inhomlimit)
    566                                 printf("<li style='color:%s'>%s: One of your %s-sequences has an inhomogeneity larger than %s (%s). </li>\n",
     586                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has an inhomogeneity larger than %s (%s). </li>\n",
    567587                                       $color["WARN"], "WARN", $val, $inhomlimit, $values["Max(fInhomogeneity)"][$val]);
    568588                            if ($values["Max(fUnsuitableInner)"][$val]>$unsuitablemaxlimit)
    569                                 printf("<li style='color:%s'>%s: One of your %s-sequences has more than %s unsuitable inner pixel (%s). </li>\n",
     589                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has more than %s unsuitable inner pixel (%s). </li>\n",
    570590                                       $color["WARN"], "WARN", $val, $unsuitablemaxlimit, $values["Max(fUnsuitableInner)"][$val]);
    571591                            if ($values["Max(fIsolatedInner)"][$val]>$isolatedlimit)
    572                             printf("<li style='color:%s'>%s: One of your %s-sequences has more than %s isolated inner pixel (%s). </li>\n",
    573                                    $color["WARN"], "WARN", $val, $isolatedlimit, $values["Max(fIsolatedInner)"][$val]);
     592                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has more than %s isolated inner pixel (%s). </li>\n",
     593                                       $color["WARN"], "WARN", $val, $isolatedlimit, $values["Max(fIsolatedInner)"][$val]);
    574594                            if ($values["Max(fIsolatedMaxCluster)"][$val]>$imclimit)
    575                                 printf("<li style='color:%s'>%s: One of your %s-sequences has more than %s isolated max cluster (%s). </li>\n",
     595                                printf("<li style='color:%s'>%s: At least one of your %s-sequences has more than %s isolated max cluster (%s). </li>\n",
    576596                                       $color["WARN"], "WARN", $val, $imclimit, $values["Max(fIsolatedMaxCluster)"][$val]);
    577597                        }
    578598                        //check selected dataset for errors
    579599                        if (!empty($on) && $values["Max(fMeanPedRmsInner)"]["on"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms)
    580                             printf("<li style='color:%s'>%s: One of your on-sequences has a PedRms larger than %s (%s).</li>\n",
     600                            printf("<li style='color:%s'>%s: At least one of your on-sequences has a PedRms larger than %s (%s).</li>\n",
    581601                                   $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["on"]);
    582602                        if (!empty($off) && $values["Max(fMeanPedRmsInner)"]["off"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms)
    583                             printf("<li style='color:%s'>%s: One of your off-sequences has a PedRms larger than %s (%s). </li>\n",
     603                            printf("<li style='color:%s'>%s: At least one of your off-sequences has a PedRms larger than %s (%s). </li>\n",
    584604                                   $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["off"]);
    585605                        if (!empty($off) && $values["Min(fMeanPedRmsInner)"]["off"]<$values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms)
    586                             printf("<li style='color:%s'>%s: One of your off-sequences has a PedRms smaller than %s (%s). </li>\n",
     606                            printf("<li style='color:%s'>%s: At least one of your off-sequences has a PedRms smaller than %s (%s). </li>\n",
    587607                                   $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms, $values["Min(fMeanPedRmsInner)"]["off"]);
    588608                        $scale=$values["Sum(fRunTime)/60"]["on"]/$values["Sum(fRunTime)/60"]["off"];
     
    598618                        if ($obskey!=$_SESSION["obsmode"])
    599619                        {
    600                             printf("<li style='color:%s'>%s: You have not selected any Off sequences. </li>\n",
    601                                    $color["ERROR"], "ERROR", $doubleseq);
     620                            printf("<li style='color:%s'>%s: You have a mistake in your observation mode. </li>\n",
     621                                   $color["ERROR"], "ERROR");
    602622                            $numerr=$numerr+1;
    603623                        }
     
    659679                            printf("SequencesOff: %s<br>\n", $_SESSION["sequoff"]);
    660680
    661                         //set observation mode
    662                         if ($_SESSION["sequoff"]==" ")
    663                             $obsmode="Wobble";
    664                         else
    665                             $obsmode="On";
    666                         //get key from db for insert query
    667                         $query   = "SELECT fObservationModeKEY FROM ObservationMode WHERE fObservationModeName='".$obsmode."'";
    668                         $result  = mysql_query($query);
    669                         $row = mysql_fetch_assoc($result);
    670                         $_SESSION["obsmode"] = $row["fObservationModeKEY"];
    671                         mysql_free_result($result);
    672681                        printf("Observation mode: %s <br>\n", $obsmode);
    673682                        printf("RunTime: %s min <br>\n", $_SESSION["runtime"]);
     
    738747                }
    739748                else
     749                {
    740750                    printf("<input type='submit' value='Get Data Set'><br><br>\n");
     751                    printf("Remark: To store your selection you have to press 'Get Data Set'<br> \n");
     752                }
    741753
    742754                printf("</div>\n");
     
    789801            $_SESSION[$element]=$value;
    790802
    791 
    792 
    793803    if ($debug)
    794804        print_r($_SESSION);
    795805
    796     // remove sequence from selection
    797     if (!empty($_POST) && $_SESSION["DisplaySelected"]=="yes" && $_SESSION["DisplaySelectedOld"]=="yes")
    798         foreach ($_SESSION as $key => $element)
    799             if (($_SESSION[$key]=="On") //value is set
    800                 && (ereg("^[0-9]*ON$", $key) || ereg("^[0-9]*Off$", $key)) // it is a sequence number
    801                 && (!$_POST[$key]==On)) // the sequence is not given in $_POST any more
    802                 unset($_SESSION[$key]);
    803 
    804     //store old value of $_SESSION["DisplaySelected"]
    805806    if ($_SESSION["DisplaySelected"]=="yes")
    806807    {
    807808        unset($_SESSION["fNumStart"]);
    808809        $_GET["fNumStart"]=0;
    809         $_SESSION["DisplaySelectedOld"]="yes";
    810     }
    811     else
    812         $_SESSION["DisplaySelectedOld"]="no";
    813 
    814     $_SESSION["sequon"]=" ";
    815     $_SESSION["sequoff"]=" ";
     810    }
     811
     812    $_SESSION["sequon"]="";
     813    $_SESSION["sequoff"]="";
    816814    foreach($_SESSION as $key => $val)
    817         if ($val=="On")
    818         {
    819             if (ereg("^[0-9]*ON$", $key))
    820                 $_SESSION["sequon"].=str_replace("ON", " ", $key);
    821             if (ereg("^[0-9]*Off$", $key))
    822                 $_SESSION["sequoff"].=str_replace("Off", " ", $key);
    823         }
    824     if ($_SESSION["sequon"]==" " && $_SESSION["sequoff"]==" ")
    825     {
    826         $_SESSION["DisplaySelected"]="no";
    827         $_SESSION["DisplaySelectedOld"]="no";
     815    {
     816        if ($val=="ON" && ereg("^DSSeq[0-9]*$", $key))
     817            $_SESSION["sequon"].=str_replace("DSSeq", " ", $key);
     818
     819        if ($val=="Off" && ereg("^DSSeq[0-9]*$", $key))
     820            $_SESSION["sequoff"].=str_replace("DSSeq", " ", $key);
     821
     822        if ($val=="Not" && ereg("^DSSeq[0-9]*$", $key))
     823            unset($_SESSION[$key]);
     824
    828825    }
    829826
     
    855852        {
    856853//            echo crypt($_SERVER['PHP_AUTH_PW']). "<br>";
     854//            echo "with crypt: " . crypt($_SERVER['PHP_AUTH_PW'], $userrow["fPassword"]) . " for user " . $userrow["fUserName"]. "<br>";
    857855            if (crypt($_SERVER['PHP_AUTH_PW'], $userrow["fPassword"])==$userrow["fPassword"]
    858856                && $_SERVER['PHP_AUTH_USER']==$userrow["fUserName"])
     
    882880            header("Content-Disposition: attachment; filename=dataset_".str_replace(" ", "_", $_SESSION["name"]).".txt");
    883881            PrintDataSetFile();
    884             echo "hallo\n";
    885882        }
    886883        unset($_SESSION["fSendTxt"]);
  • trunk/MagicSoft/Mars/datacenter/db/include.php

    r9498 r9505  
    301301}
    302302
     303function RadioButton($name, $value, $text)
     304{
     305    if ($_SESSION[$name]==$value)
     306        $checked = "checked";
     307    else
     308        $checked = "";
     309
     310    printf("    <td><input type='radio' name='%s' value='%s' %s>%s</td>\n", $name, $value, $checked, $text);
     311}
     312
    303313function CheckWhere($column)
    304314{
     
    417427function PrintDisplaySequencesButtons()
    418428{
    419     if ($_SESSION["DisplaySelected"]!="yes" && ($_SESSION["sequon"]!=" " || $_SESSION["sequoff"]!=" "))
     429    if ((empty($_SESSION["DisplaySelected"]) || $_SESSION["DisplaySelected"]=="no")
     430        && !(empty($_SESSION["sequon"]) && empty($_SESSION["sequoff"])))
    420431    {
    421432        PrintUpdateDataSetButton();
    422         printf("<input type='button' value='Display Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=yes\"'><br><br>\n", GetClearedURL("yes"));
     433        printf("<input type='button' value='Display Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=yes\"'>\n", GetClearedURL("yes"));
     434        printf("&nbsp;&nbsp;&nbsp;<input type='button' value='Display Not-Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=inverse\"'>\n", GetClearedURL("yes"));
     435        printf("<br><br>\n");
    423436    }
    424437
     
    426439    {
    427440        PrintUpdateDataSetButton();
    428         printf("<input type='button' value='Display All Sequences' onClick='self.location.href=\"%s&DisplaySelected=no\"'>\n", GetClearedURL("yes"));
     441        printf("<input type='button' value='Display Not-Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=inverse\"'>\n", GetClearedURL("yes"));
     442        printf("&nbsp;&nbsp;&nbsp;<input type='button' value='Display All Sequences' onClick='self.location.href=\"%s&DisplaySelected=no\"'>\n", GetClearedURL("yes"));
    429443        printf("&nbsp;&nbsp;&nbsp;<i>Currently only selected sequences are displayed.</i><br><br>\n");
    430444    }
    431 }
    432 
    433 
    434 function ReplaceInUri($name, $rows, $direction, $result1=0)
    435 {
     445
     446    if ($_SESSION["DisplaySelected"]=="inverse")
     447    {
     448        PrintUpdateDataSetButton();
     449        printf("<input type='button' value='Display Selected Sequences' onClick='self.location.href=\"%s&DisplaySelected=yes\"'>\n", GetClearedURL("yes"));
     450        printf("&nbsp;&nbsp;&nbsp;<input type='button' value='Display All Sequences' onClick='self.location.href=\"%s&DisplaySelected=no\"'>\n", GetClearedURL("yes"));
     451        printf("&nbsp;&nbsp;&nbsp;<i>Currently only NOT selected sequences are displayed.</i><br><br>\n");
     452    }
     453}
     454
     455
     456function ReplaceInUri($name, $rows, $direction, $totalnumrows=0)
     457{
     458    //direction:
     459    // 0: Prev Link
     460    // 1: Next Link
     461    // 2: First Link
     462    // 3: Last Link
     463
    436464    $uri = htmlspecialchars($_SERVER["REQUEST_URI"]);
    437465    $pos = strpos($uri, "fNumStart");
     
    460488        break;
    461489    case 3:
    462         $row1 = mysql_fetch_assoc($result1);
    463         $pos = $row1["FOUND_ROWS()"]-$rows+1;
     490        $pos = $totalnumrows-$rows+1;
    464491        break;
    465492    }
     
    487514}
    488515
    489 function CreateMenu($rows, $result1)
     516function CreateMenu($rows, $totalnumrows)
    490517{
    491518    $menu = "";
     
    510537    {
    511538        $menu .= ReplaceInUri("fNumStart", $rows, 1);
    512         $menu .= ReplaceInUri("fNumStart", $rows, 3, $result1);
     539        $menu .= ReplaceInUri("fNumStart", $rows, 3, $totalnumrows);
    513540    }
    514541    return $menu;
     
    517544function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $result1, $form="")
    518545{
     546    $row1 = mysql_fetch_assoc($result1);
     547    $totalnumrows=$row1["FOUND_ROWS()"];
     548//    echo "res0: " . $row . " res1: " . $row1["FOUND_ROWS()"] . "<br>";
     549
    519550    $col   = FALSE;
    520551    $first = TRUE;
     
    530561
    531562
    532     $menu = CreateMenu(mysql_num_rows($result0), $result1);
     563    $menu = CreateMenu(mysql_num_rows($result0), $totalnumrows);
    533564
    534565    if ($form)
     
    550581            $first = FALSE;
    551582            if ($form)
    552                 printf("<td>ON</td><td>Off</td>");
     583                printf("<td>ON</td><td>Off</td><td>Not</td>");
    553584            foreach ($row0 as $key => $element)
    554585            {
     
    582613        if ($form)
    583614        {
    584             CheckBox2($row0["Sequ"]."ON","");
    585             CheckBox2($row0["Sequ"]."Off","");
     615//            CheckBox2($row0["Sequ"]."ON","");
     616//            CheckBox2($row0["Sequ"]."Off","");
     617            RadioButton("DSSeq".$row0["Sequ"],  "ON", "");
     618            RadioButton("DSSeq".$row0["Sequ"], "Off", "");
     619            RadioButton("DSSeq".$row0["Sequ"], "Not", "");
    586620        }
    587621        foreach ($row0 as $key => $element)
     
    671705     */
    672706
    673     $row1 = mysql_fetch_assoc($result1);
    674     printf("<P><B>Number of displayed results: %d of %s in total</B><P><P>\n", mysql_num_rows($result0), $row1["FOUND_ROWS()"]);
     707    printf("<P><B>Number of displayed results: %d of %s in total</B><P><P>\n", mysql_num_rows($result0), $totalnumrows);
    675708    if (empty($_GET["fPrintTable"]))
    676709        printf("%s\n", $menu);
Note: See TracChangeset for help on using the changeset viewer.