Changeset 12 for trunk/grails-app/domain


Ignore:
Timestamp:
Feb 9, 2011, 9:04:29 AM (10 years ago)
Author:
robert@…
Message:

Implemented basic exporting functionality

Location:
trunk/grails-app/domain/nl/tno/metagenomics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/nl/tno/metagenomics/AssaySample.groovy

    r9 r12  
    1111        private long _numSequences = -1;
    1212        private float _averageQuality = -1.0;
     13        private long _numQualScores = -1;
    1314
    1415        Integer numUniqueSequences      // Number of unique sequences / OTUs. Is only available after preprocessing
     
    137138                return numSequences;
    138139        }
    139 
     140       
     141        /**
     142         * Returns the number of quality scores in the files on the system, belonging to this
     143         * assay-sample combination.
     144         *
     145         * @return
     146         */
     147        public long numQualScores() {
     148                if( _numQualScores > -1 )
     149                        return _numQualScores;
     150
     151                if( !sequenceData )
     152                        return 0
     153
     154                long numQualScores = 0;
     155                sequenceData.each { numQualScores += it.numQualScores() }
     156
     157                // Save as cache
     158                _numQualScores = numQualScores;
     159
     160                return numQualScores;
     161        }
    140162        /**
    141163         * Returns the average quality of the sequences in the files on the system,
     
    170192        public void resetStats() {
    171193                _numSequences = -1;
     194                _numQualScores = -1;
    172195                _averageQuality = -1;
    173196        }
  • trunk/grails-app/domain/nl/tno/metagenomics/SequenceData.groovy

    r7 r12  
    3333        }
    3434       
     35       
     36        /**
     37         * Returns the number of quality scores in this data object. This equals
     38         * the number of sequences iff a quality score is attached to this object
     39         *
     40         * @return      Number of quality scores in this object
     41         */
     42        public int numQualScores() {
     43                if( qualityFile != null )
     44                        return numSequences
     45                else
     46                        return 0;
     47        }
     48       
    3549        def beforeDelete = {
    3650                def permanentDir = fileService.absolutePath( ConfigurationHolder.config.metagenomics.fileDir.toString() )
Note: See TracChangeset for help on using the changeset viewer.