Changeset 658


Ignore:
Timestamp:
Jul 19, 2010, 9:02:15 AM (11 years ago)
Author:
vinlud
Message:

Sam result merging

File:
1 edited

Legend:

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

    r650 r658  
    109109              try {
    110110                searchGscfResult = searchableService.search(flow.search_term)
     111                println "RESULT: " + searchGscfResult
    111112              } catch (SearchEngineQueryParseException ex) {
    112113                println ex
     
    171172    }
    172173
    173 
    174    static List searchSAM (List compounds) {
     174 
     175   static Map searchSAM (List compounds) {
    175176     if (compounds.size() == 1) {
    176177       println "Single SAM call"
    177178       def mapSamResult
    178179       mapSamResult = CommunicationManager.getQueryResult(compounds.get(0))
    179        
    180        return mapSamResult.studies
     180       println "CommMngr result: " + mapSamResult.assays.size()
     181
     182       mapSamResult.assays.each {
     183         simpleAssay -> println simpleAssay.id
     184         
     185       }
     186
     187       return mapSamResult
    181188
    182189     } else {
    183190       println "Multiple SAM calls"
    184        def tmpSamResult
     191       def tmpSamResult = [:]
     192       def mapSamResult = [studies:[], assays:[]]
    185193       def i = 0
    186194
    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       compounds.each { compound ->
     196         println "SAM Search with " + compound
     197         tmpSamResult = CommunicationManager.getQueryResult(compound)
     198         println tmpSamResult.assays.size() + " results " + compound
     199
     200         if (i == 0) {
     201           mapSamResult.assays = tmpSamResult.assays
     202           mapSamResult.studies = tmpSamResult.studies
     203         } else {
     204           mapSamResult.assays = mapSamResult.assays.intersect(tmpSamResult.assays)
     205           mapSamResult.studies = mapSamResult.studies.intersect(tmpSamResult.studies)
     206         }
     207
    195208         i++
    196        };
     209       }
     210
     211       return mapSamResult
    197212     }
    198213
Note: See TracChangeset for help on using the changeset viewer.