Changeset 72 for trunk/grails-app/domain


Ignore:
Timestamp:
Jun 18, 2011, 10:23:22 PM (9 years ago)
Author:
robert@…
Message:

Implemented addition of logfiles to sequence data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/nl/tno/massSequencing/SequenceData.groovy

    r59 r72  
    22
    33import org.codehaus.groovy.grails.commons.ConfigurationHolder
     4import nl.tno.massSequencing.classification.Classification
    45
    56class SequenceData {
     
    1112        Float averageQuality = 0.0
    1213
     14        // Store the logfile with data about how this sample is processed
     15        String logFile
     16       
    1317        static belongsTo = [sample: AssaySample]
    1418        static constraints = {
    1519                qualityFile(nullable: true)
     20                logFile(nullable:true)
    1621                numSequences(nullable: true)
    1722                averageQuality(nullable: true)
     
    3338        }
    3439       
    35        
    3640        /**
    3741         * Returns the number of quality scores in this data object. This equals
     
    4650                        return 0;
    4751        }
    48        
     52
     53        /**
     54        * Returns the number of classification scores in this data object.
     55        *
     56        * @return       Number of classifications of sequences in this data object
     57        */
     58   public int numClassifications() {
     59           def num = Classification.executeQuery( "SELECT COUNT(*) FROM Sequence s WHERE s.sequenceData = :sd", [ "sd": this ] );
     60           
     61           return num[ 0 ] ?: 0;
     62   }
     63               
    4964        def beforeDelete = {
    5065                def permanentDir = fileService.absolutePath( ConfigurationHolder.config.massSequencing.fileDir.toString() )
     
    5671                        fileService.delete( qualityFile, permanentDir )
    5772               
     73                if( logFile )
     74                        fileService.delete( logFile, permanentDir )
    5875                       
    5976                // Remove all sequence objects referencing this sequenceData object
Note: See TracChangeset for help on using the changeset viewer.