Last change
on this file since 7 was
7,
checked in by robert@…, 12 years ago
|
- Created tests for the synchronization and trash
- Improved synchronizationservice and trash
- Put authorization checks in several pages
|
File size:
1.1 KB
|
Line | |
---|
1 | package nl.tno.metagenomics |
---|
2 | |
---|
3 | import org.codehaus.groovy.grails.commons.ConfigurationHolder |
---|
4 | |
---|
5 | class SequenceData { |
---|
6 | def fileService |
---|
7 | |
---|
8 | String sequenceFile = '' |
---|
9 | String qualityFile = '' |
---|
10 | Long numSequences = 0L |
---|
11 | Float averageQuality = 0.0 |
---|
12 | |
---|
13 | static belongsTo = [sample: AssaySample] |
---|
14 | static constraints = { |
---|
15 | qualityFile(nullable: true) |
---|
16 | numSequences(nullable: true) |
---|
17 | averageQuality(nullable: true) |
---|
18 | } |
---|
19 | |
---|
20 | /** |
---|
21 | * Returns the number of files in this data object. |
---|
22 | * @return |
---|
23 | */ |
---|
24 | public int numFiles() { |
---|
25 | int number = 0; |
---|
26 | if( sequenceFile != null && sequenceFile != "" ) |
---|
27 | number++; |
---|
28 | |
---|
29 | if( qualityFile != null && qualityFile != "" ) |
---|
30 | number++; |
---|
31 | |
---|
32 | return number; |
---|
33 | } |
---|
34 | |
---|
35 | def beforeDelete = { |
---|
36 | def permanentDir = fileService.absolutePath( ConfigurationHolder.config.metagenomics.fileDir.toString() ) |
---|
37 | if( sequenceFile ) { |
---|
38 | fileService.delete( sequenceFile, permanentDir ) |
---|
39 | } |
---|
40 | |
---|
41 | if( qualityFile ) |
---|
42 | fileService.delete( qualityFile, permanentDir ) |
---|
43 | |
---|
44 | // Reset statistics of the assay sample, to ensure the deleted files are removed from statistics |
---|
45 | sample.resetStats(); |
---|
46 | } |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.