Changeset 1727
- Timestamp:
- Apr 7, 2011, 3:57:59 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/studycapturing/AssayService.groovy
r1716 r1727 227 227 def lastDataIndex = moduleData.size() - 1 228 228 def stepSize = sampleTokens.size() + 1 229 230 // Transpose the data to order it by measurement (compound) so it can be 231 // written as 1 column 232 int i = 0 233 measurementTokens.inject([:]) { map, token -> 234 235 map + [(token): moduleData[(i++..lastDataIndex).step(stepSize)]] 236 237 } 238 229 230 // Convert the three different maps into a map like: 231 // 232 // [ "measurement 1": [ value1, value2, value3 ], 233 // "measurement 2": [ value4, value5, value6 ] 234 // 235 def map = [:] 236 def numSamples = sampleTokens.size(); 237 def idx = 0; 238 239 // Loop through all measurementtokens, and get the right slice from the measurement list 240 measurementTokens.each { measurementToken -> 241 def startIndex = idx++ * numSamples; 242 def stopIndex = startIndex + numSamples - 1; 243 map[ measurementToken.toString() ] = moduleData[ startIndex..stopIndex ].collect { it.toString() } 244 } 245 246 return map; 239 247 } 240 248
Note: See TracChangeset
for help on using the changeset viewer.