Changeset 650
- Timestamp:
- Jul 13, 2010, 6:26:50 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/query/SimpleQueryController.groovy
r642 r650 36 36 println "Starting webflow simpleQuery" 37 37 flow.search_term = null 38 flow.search_sa_compounds = [] 39 flow.search_sa_operators = [] 40 flow.search_sa_values = [] 38 41 flow.page = 0 39 42 flow.pages = [ … … 50 53 println "Rendering mainPage" 51 54 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 53 64 flow.species = Term.findAll() 54 65 flow.page = 1 … … 69 80 searching { 70 81 action { 71 println "Starting s earch..."82 println "Starting simpleQuery search..." 72 83 def searchResult 73 84 def searchGscfResult 74 def searchSamResult 85 def searchSamResult = [] 75 86 76 87 // TODO: walk parameters, remove empty entries 77 88 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) 89 102 } 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 91 106 } 92 107 … … 102 117 // ... todo when the plugin works and I can see the output 103 118 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 124 128 // Merge the results of all searches 125 /*126 129 if (searchGscfResult.size() > 0) { 127 searchResult = Merge(searchSamResult, searchGscfResult) 130 131 searchResult = searchSamResult + searchGscfResult 128 132 } 129 */130 133 131 134 132 135 // Save the results in the flow 133 136 flow.listStudies = searchGscfResult.results 137 println flow.listStudies 134 138 135 139 } … … 148 152 flow.page = 2 149 153 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 158 155 } 159 156 … … 173 170 174 171 } 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 175 211 } -
trunk/grails-app/views/simpleQuery/common/_query.gsp
r647 r650 30 30 </div> 31 31 32 <h3><a href="#">Simple Assays </a></h3>32 <h3><a href="#">Simple Assays (optional)</a></h3> 33 33 <div class="element"> 34 34 <div id="compoundGroup"> … … 36 36 <g:if test="${showFirstRowCompounds}"> 37 37 <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> 44 39 </div> 45 40 </g:if> … … 48 43 <g:each status="i" in="${search_sa_compounds}" var="compound"> 49 44 <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> 56 46 </div> 57 47 </g:each> … … 61 51 </div> 62 52 63 <h3><a href="#">Transcriptomics </a></h3>53 <h3><a href="#">Transcriptomics (optional)</a></h3> 64 54 65 55 <div class="element"> 66 56 <div id="transcriptomeGroup"> 67 57 <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> 72 59 </div> 73 60 </div> 74 <div id="addTranscriptome" >Add transciptome</div>61 <div id="addTranscriptome" class="submit">Add transciptome</div> 75 62 </div> 76 63 </div> … … 81 68 82 69 <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> 84 71 85 72 <g:if test="${listStudies}"> … … 88 75 <thead> 89 76 <tr> 77 <g:sortableColumn property="id" title="${message(code: 'study.id', default: 'ID')}" /> 90 78 <g:sortableColumn property="title" title="${message(code: 'study.title.label', default: 'Study')}" /> 79 <g:sortableColumn property="samples" title="${message(code: 'study.sample', default: 'Samples')}" /> 91 80 </tr> 92 81 </thead> … … 94 83 <g:each in="${listStudies}" var="Study" status="i" > 95 84 <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> 96 86 <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> 97 88 </tr> 98 89 </g:each> -
trunk/web-app/css/simpleQuery.css
r647 r650 26 26 27 27 .simplequery .submit { 28 padding:5px;29 display: inline;28 margin-top: 15px; 29 padding: 2px; 30 30 font-size: 11px; 31 word-wrap: break-word; 31 border: 3px outset lightblue; 32 width: 100px; 33 text-align: center; 32 34 } 33 35 34 36 .simplequery .element .input { 35 37 display: inline; 36 margin-right: 10px;37 38 font-size: 11px; 38 word-wrap: break-word;39 39 } 40 40 … … 42 42 vertical-align: top; 43 43 border: 1px solid #CCC; 44 margin: 2px 0;45 padding: 2px 4px;46 44 } 47 45 -
trunk/web-app/js/simpleQuery.js
r647 r650 56 56 newCompoundRowDiv6.innerHTML = "<input type='text' name='sa_value' value=''>"; 57 57 newCompoundDiv.appendChild(newCompoundRowDiv6); 58 59 //var newCompoundRowDiv7 = document.createElement('div'); 60 //newCompoundRowDiv7.setAttribute('class', 'delete'); 61 //newCompoundRowDiv7.innerHTML = "delete"; 62 //newCompoundDiv.appendChild(newCompoundRowDiv7); 58 63 compoundGroup.appendChild(newCompoundDiv); 59 64
Note: See TracChangeset
for help on using the changeset viewer.