Changeset 650


Ignore:
Timestamp:
Jul 13, 2010, 6:26:50 PM (13 years ago)
Author:
vinlud
Message:

Multiple changes in structure/view/logic

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/query/SimpleQueryController.groovy

    r642 r650  
    3636            println "Starting webflow simpleQuery"
    3737            flow.search_term            = null
     38            flow.search_sa_compounds    = []
     39            flow.search_sa_operators    = []
     40            flow.search_sa_values       = []
    3841            flow.page                   = 0
    3942                        flow.pages = [
     
    5053              println "Rendering mainPage"
    5154              flow.operators              = ['>', '=', '<']
    52               flow.showFirstRowCompounds  = true
     55
     56              if (flow.search_sa_compounds.size() == 0) {
     57                flow.showFirstRowCompounds  = true
     58                println "showRow true"
     59              } else {
     60                flow.showFirstRowCompounds  = false
     61                println "showRow false"
     62              }
     63
    5364              flow.species = Term.findAll()
    5465              flow.page = 1
     
    6980        searching {
    7081           action {
    71               println "Starting search..."
     82              println "Starting simpleQuery search..."
    7283              def searchResult
    7384              def searchGscfResult
    74               def searchSamResult
     85              def searchSamResult   = []
    7586
    7687              // TODO: walk parameters, remove empty entries
    7788
    78               // Map parameters
    79               flow.search_term            = params.search_term
    80               flow.search_sa_compounds    = params.sa_compound
    81               flow.search_sa_operators    = params.sa_operator
    82               flow.search_sa_values       = params.sa_value
    83               flow.search_tt_genepaths    = params.sa_genepath
    84               flow.search_tt_regulations  = params.sa_regulation
    85 
    86               // Check to see how parameters are being handled
    87               if (flow.search_sa_compounds.class.getName() == "java.lang.String") {
    88                 println "string"
     89              // Map GSCF parameters
     90              flow.search_term            = params.search_term        // String
     91
     92              // Map SAM parameters
     93              if (params.sa_compound instanceof String) {
     94                //flow.search_sam = [:]
     95                flow.search_sa_compounds = []
     96                flow.search_sa_operators = []
     97                flow.search_sa_values    = []
     98
     99                flow.search_sa_compounds.add(params.sa_compound)
     100                flow.search_sa_operators.add(params.sa_operator)
     101                flow.search_sa_values.add(params.sa_value)
    89102              } else {
    90                 println "array of size " + flow.search_sa_compounds.length
     103                flow.search_sa_compounds  = params.sa_compound as List
     104                flow.search_sa_operators  = params.sa_operator as List
     105                flow.search_sa_values     = params.sa_value as List
    91106              }
    92107
     
    102117              // ... todo when the plugin works and I can see the output
    103118
    104               // Search in the SAM module
    105               println "checking compounds"
    106               if (flow.search_sa_compounds) {
    107                 objComs = new CommunicationManager()
    108 
    109                 if (flow.search_sa_compounds.class.getName() == "java.lang.String") {
    110                   searchSamResult = objComs.getSAMStudies(flow.search_sa_compounds, flow.search_sa_values, flow.search_sa_operators)
    111                 } else {
    112                   def tmpSamResult
    113                   flow.search_sa_compounds.each {
    114                     obj, i -> println " ${i}: ${obj}" // objComs.getSAMStudies()
    115                     tmpSamResult = objComs.getSAMStudies(flow.search_sa_compounds[i], flow.search_sa_values[i], flow.search_sa_operators[i])
    116 
    117                     // Combine each search
    118                     // searchSamResult = Merge(searchSamResult, tmpSamResult)
    119                     searchSamResult = tmpSamResult
    120                   };
    121                 }
    122               }
    123 
     119              // Search in the SAM module when a compound is entered
     120              // Todo: check whether the module is active and to be used
     121              // ...
     122              if (flow.search_sa_compounds.size() > 0) {
     123                def resultSAM = []
     124                resultSAM = this.searchSAM(flow.search_sa_compounds)
     125                println "Sam result: " + resultSAM
     126              }
     127                                         
    124128             // Merge the results of all searches
    125              /*
    126129             if (searchGscfResult.size() > 0) {
    127                 searchResult = Merge(searchSamResult, searchGscfResult)
     130               
     131                searchResult = searchSamResult + searchGscfResult
    128132             }             
    129              */
    130133
    131134
    132135             // Save the results in the flow
    133136             flow.listStudies = searchGscfResult.results
     137             println flow.listStudies
    134138
    135139           }
     
    148152              flow.page = 2
    149153
    150               // TODO: Fix the showing of entered data, broke with plugin develeopment
    151               if (flow.search_sa_compounds) {
    152                 if (flow.search_sa_compounds.class.getName() == "java.lang.String") {
    153                   flow.resultString = true
    154                 } else {
    155                   flow.resultString = false
    156                 }
    157               }
     154              flow.showFirstRowCompounds  = false
    158155            }
    159156
     
    173170
    174171    }
     172
     173
     174   static List searchSAM (List compounds) {
     175     if (compounds.size() == 1) {
     176       println "Single SAM call"
     177       def mapSamResult
     178       mapSamResult = CommunicationManager.getQueryResult(compounds.get(0))
     179       
     180       return mapSamResult.studies
     181
     182     } else {
     183       println "Multiple SAM calls"
     184       def tmpSamResult
     185       def i = 0
     186
     187       compounds.each() {
     188         println compounds.get(i)
     189
     190         println "set tmpSamResult"
     191
     192         // Combine each search
     193         // searchSamResult = Merge(searchSamResult, tmpSamResult)
     194         // searchSamResult += tmpSamResult
     195         i++
     196       };
     197     }
     198
     199   }
     200
     201
     202
     203   static List merge (List list1, List list2) {
     204
     205     def resultList = []
     206     resultList = list1.intersect(list2)
     207
     208     return resultList
     209   }
     210
    175211}
  • trunk/grails-app/views/simpleQuery/common/_query.gsp

    r647 r650  
    3030      </div>
    3131
    32       <h3><a href="#">Simple Assays</a></h3>
     32      <h3><a href="#">Simple Assays (optional)</a></h3>
    3333      <div class="element">
    3434        <div id="compoundGroup">
     
    3636          <g:if test="${showFirstRowCompounds}">
    3737          <div id="compoundRow1">
    38             <div class="descriptionSA">Compound</div>
    39             <div class="input"><g:textField name="sa_compound" value="${search_sa_compounds}"/></div>
    40             <div class="descriptionSA">Operator</div>
    41             <div class="input" id="operatorInput"><g:select name="operator" from="${operators}" value="="/></div>
    42             <div class="descriptionSA">Value</div>
    43             <div class="input"><g:textField name="sa_value" value="${search_sa_values}"/></div>
     38            <div class="descriptionSA">Compound</div><div class="input"><g:textField name="sa_compound" value=""/></div><div class="descriptionSA">Operator</div><div class="input" id="operatorInput"><g:select name="operator" from="${operators}" value="="/></div><div class="descriptionSA">Value</div><div class="input"><g:textField name="sa_value" value=""/></div>
    4439          </div>
    4540          </g:if>
     
    4843            <g:each status="i" in="${search_sa_compounds}" var="compound">
    4944            <div id="compoundRow${i}">
    50               <div class="descriptionSA">Compound (e.g. 'glucose')</div>
    51               <div class="input"><g:textField name="sa_compound" value="${compound}"/></div>
    52               <div class="descriptionSA">Type of regulations</div>
    53               <div class="input"><g:select name="operator" from="${operators}" value="="/></div>
    54               <div class="descriptionSA">Value</div>
    55               <div class="input"><g:textField name="sa_value" value="${search_sa_values[i]}"/></div>
     45              <div class="descriptionSA">Compound (e.g. 'glucose')</div><div class="input"><g:textField name="sa_compound" value="${search_sa_compounds.get(i)}"/></div><div class="descriptionSA">Type of regulations</div><div class="input"><g:select name="operator" from="${operators}" value="="/></div><div class="descriptionSA">Value</div><div class="input"><g:textField name="sa_value" value="${search_sa_values.get(i)}"/></div>
    5646            </div>
    5747            </g:each>
     
    6151      </div>
    6252
    63       <h3><a href="#">Transcriptomics</a></h3>
     53      <h3><a href="#">Transcriptomics (optional)</a></h3>
    6454
    6555      <div class="element">
    6656        <div id="transcriptomeGroup">
    6757          <div id="transcriptomeRow1">
    68             <div class="description">List of Gene IDs or pathway IDs</div>
    69             <div class="input"><g:textField name="genepath" value="" /></div>
    70             <div class="description">Type of regulations</div>
    71             <div class="input" id="regulationInput"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
     58            <div class="description">List of Gene IDs or pathway IDs</div><div class="input"><g:textField name="genepath" value="" /></div><div class="description">Type of regulations</div><div class="input" id="regulationInput"><g:select name="regulation" from="" value="${regulation}" noSelection="['':'--- select regulation ---']"/></div>
    7259          </div>
    7360        </div>
    74         <div id="addTranscriptome">Add transciptome</div>
     61        <div id="addTranscriptome" class="submit">Add transciptome</div>
    7562      </div>
    7663    </div>
     
    8168
    8269    <g:if test="${search_term}">
    83         <h1><g:message code="Search results for term ${search_term}"/></h1>
     70        <h1><g:message code="Search results for term '${search_term}'"/></h1>
    8471
    8572        <g:if test="${listStudies}">
     
    8875                <thead>
    8976                    <tr>
     77                        <g:sortableColumn property="id" title="${message(code: 'study.id', default: 'ID')}" />
    9078                        <g:sortableColumn property="title" title="${message(code: 'study.title.label', default: 'Study')}" />
     79                        <g:sortableColumn property="samples" title="${message(code: 'study.sample', default: 'Samples')}" />
    9180                    </tr>
    9281                </thead>
     
    9483                <g:each in="${listStudies}" var="Study" status="i" >
    9584                  <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
     85                    <td><g:link url="[action:'show',controller:'study']" id="${Study.id}">${fieldValue(bean: Study, field: "id")}</g:link></td>
    9686                    <td><g:link url="[action:'show',controller:'study']" id="${Study.id}">${fieldValue(bean: Study, field: "title")}</g:link></td>
     87                    <td><g:link url="[action:'show',controller:'study']" id="${Study.id}">${fieldValue(bean: Study, field: "samples")}</g:link></td>
    9788                  </tr>
    9889                </g:each>
  • trunk/web-app/css/simpleQuery.css

    r647 r650  
    2626
    2727.simplequery .submit {
    28     padding: 5px;
    29     display: inline;
     28    margin-top: 15px;
     29    padding: 2px;
    3030    font-size: 11px;
    31     word-wrap: break-word;
     31    border: 3px outset lightblue;
     32    width: 100px;
     33    text-align: center;
    3234}
    3335
    3436.simplequery .element .input {
    3537    display: inline;
    36     margin-right: 10px;
    3738    font-size: 11px;
    38     word-wrap: break-word;
    3939}
    4040
     
    4242    vertical-align: top;
    4343    border: 1px solid #CCC;
    44     margin: 2px 0;
    45     padding: 2px 4px;
    4644}
    4745
  • trunk/web-app/js/simpleQuery.js

    r647 r650  
    5656        newCompoundRowDiv6.innerHTML = "<input type='text' name='sa_value' value=''>";
    5757        newCompoundDiv.appendChild(newCompoundRowDiv6);
     58
     59        //var newCompoundRowDiv7 = document.createElement('div');
     60        //newCompoundRowDiv7.setAttribute('class', 'delete');
     61        //newCompoundRowDiv7.innerHTML = "delete";
     62        //newCompoundDiv.appendChild(newCompoundRowDiv7);
    5863        compoundGroup.appendChild(newCompoundDiv);
    5964
Note: See TracChangeset for help on using the changeset viewer.