Changeset 18


Ignore:
Timestamp:
Mar 8, 2011, 11:59:30 AM (12 years ago)
Author:
robert@…
Message:

Fixed issue #11: export of excel sample data is now column wise

Location:
trunk
Files:
17 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/application.properties

    r6 r18  
    11#Grails Metadata file
    2 #Wed Jan 19 09:55:04 CET 2011
     2#Mon Feb 28 15:08:16 CET 2011
    33app.build.display.info=0
    4 app.grails.version=1.3.6
     4app.grails.version=1.3.7
    55app.name=metagenomics
    66app.servlet.version=2.4
     
    88plugins.db-util=0.4
    99plugins.famfamfam=1.0.1
    10 plugins.hibernate=1.3.6
     10plugins.hibernate=1.3.7
    1111plugins.jquery=1.4.4.1
    1212plugins.jquery-ui=1.8.7
    13 plugins.tomcat=1.3.6
     13plugins.tomcat=1.3.7
  • trunk/grails-app/conf/BaseFilters.groovy

    r14 r18  
    3232                userCheck(controller:'*', action:'*') {
    3333                        before = {
    34                                 if( actionName == "notifyStudyChange" && controllerName == "rest" ) {
     34                                if( actionName == "notifyStudyChange" ) {
    3535                                        return true;
    3636                                }
     
    4040                                        return false
    4141                                }
    42 
    4342                               
    4443                                // We are handling the Rest controller as a special case. The rest calls are made
     
    132131                                } else {
    133132                                        session.sessionToken = "${UUID.randomUUID()}"
    134                                         log.info("SessionToken created, redirectiong to GSCF to let the user login! (SessionToken: ${session.sessionToken}")
     133                                        log.info("SessionToken created, redirecting to GSCF to let the user login! (SessionToken: ${session.sessionToken}")
    135134
    136135                                        redirect( url: gscfService.urlAuthRemote(params, session.sessionToken) )
  • trunk/grails-app/controllers/nl/tno/metagenomics/RunController.groovy

    r14 r18  
    554554                } catch( Exception e ) {
    555555                        log.error( "Exception occurred during export of sequences. Probably the user has cancelled the download." );
     556                        throw e
    556557                }
    557558        }
  • trunk/grails-app/controllers/nl/tno/metagenomics/integration/RestController.groovy

    r14 r18  
    22
    33import grails.converters.*
    4 import nl.tno.metagenomics.Study
    5 import nl.tno.metagenomics.Sample
    6 import nl.tno.metagenomics.Assay
     4import nl.tno.metagenomics.*
    75
    86import org.apache.catalina.connector.Response;
     
    185183         */
    186184        def getQueryableFieldData = {
     185                println "Get queryable Field data: " + params
     186               
    187187                def entity = params.entity;
    188188                def tokens = params.tokens ?: []
     
    450450         *   {"name":"average quality", "unit":"Phred"} ]
    451451         */
    452         def getMeasurementMetadata = {
     452        def getMeasurementMetaData = {
    453453                def assayToken = params.assayToken
    454454                def measurementTokens = params.measurementToken
     
    461461                // For now, we don't have any metadata about the measurements
    462462                def measurements = getMeasurementTypes();
    463                 def measurementMetadata = []
     463                def measurementMetadata = [ ]
    464464
    465465                measurementTokens.each { token ->
     
    602602                }
    603603
    604                 def data = SampleAssay.findAllByAssay( assay );
     604                def data = AssaySample.findAllByAssay( assay );
    605605                def measurements = getMeasurementTypes()
    606606
    607607                def results = []
    608                 data.each { sampleAssay ->
     608                data.each { assaySample ->
    609609                        measurements.each { type ->
    610                                 def sample = sampleAssay.sample.sampleToken
     610                                def sample = assaySample.sample.sampleToken
    611611                                def isMatch = false
    612612
     
    614614                                if( ( measurementTokens.isEmpty() || measurementTokens.contains( type ) ) &&
    615615                                ( sampleTokens.isEmpty()      || sampleTokens.contains( sample ) ) ) {
    616                                         results.push( [ 'sampleToken': sample, 'measurementToken': type, 'value': sampleAssay[ type ] ] )
     616                                        results.push( [ 'sampleToken': sample, 'measurementToken': type, 'value': assaySample[ type ] ] )
    617617                                }
    618618                        }
  • trunk/grails-app/controllers/nl/tno/metagenomics/integration/SynchronizeController.groovy

    r17 r18  
    2323        def perform = {
    2424                try {
     25                        if( !session.user ) {
     26                                throw new Exception( "No user is logged in" );
     27                        }
     28                       
    2529                        synchronizationService.sessionToken = session.sessionToken
    2630                        synchronizationService.user = session.user
  • trunk/grails-app/services/nl/tno/metagenomics/SampleExcelService.groovy

    r14 r18  
    304304                }
    305305               
     306                // Transpose data and create new headers
     307                data = data.transpose();
     308               
     309                // Add field names in front of the data
     310                for( int i = 0; i < data.size(); i++ ) {
     311                        data[ i ] = [] + fields[ "descriptions" ][ "all" ][ i ] + data[ i ]
     312                }
     313               
    306314                // Create excel file
    307315                def sheetIndex = 0;
     
    311319
    312320                // Put the headers on the first row
    313                 excelService.writeHeader( wb, fields[ "descriptions" ][ "all" ], sheetIndex );
    314                 excelService.writeData( wb, data, sheetIndex, 1 );
     321                //excelService.writeHeader( wb, data[ 0 ], sheetIndex );
     322                excelService.writeData( wb, data, sheetIndex, 0 );
    315323
    316324                // Auto resize columns
  • trunk/grails-app/services/nl/tno/metagenomics/integration/GscfService.groovy

    r14 r18  
    8282                        return user
    8383                } catch( Exception e ) {
     84                        e.printStackTrace();
     85                        return null
    8486                        throw new Exception( "Retrieving user details from GSCF failed", e );
    8587                }
     
    328330                        throw new Exception( "Calling GSCF Rest method ${restMethod} failed. Please check log for more information.", e )
    329331                }
    330 
     332               
    331333                switch( connection.responseCode ) {
    332334                        case 400:       // Bad request
     
    337339                                break;
    338340                        case 403:       // Incorrect authentication
     341                                println "Not authenticated (" + addr + "): " + connection.responseCode
    339342                                throw new NotAuthenticatedException( "User is not authenticated with GSCF." );
    340343                                break;
  • trunk/grails-app/views/run/index.gsp

    r14 r18  
    2121                <g:if test="${runs.size() == 0}">
    2222                        <p>
    23                                 Currently there are no studies available in the database. Click <a href="#" onClick="showAddRunDialog(); return false;">here</a> to add a new run.
     23                                Currently there are no runs available in the database. Click <a href="#" onClick="showAddRunDialog(); return false;">here</a> to add a new run.
    2424                        </p>
    2525                </g:if>
Note: See TracChangeset for help on using the changeset viewer.