1 | package dbnp.studycapturing |
---|
2 | |
---|
3 | /** |
---|
4 | * This class describes an Assay, which describes the application of a certain (omics) measurement to multiple samples. |
---|
5 | * The actual data of these measurements are described in submodules of dbNP. The type property describes in which module |
---|
6 | * this data can be found. |
---|
7 | */ |
---|
8 | class Assay extends TemplateEntity { |
---|
9 | // The name of the assay, which should indicate the measurements represented in this assay to the user. |
---|
10 | String name |
---|
11 | |
---|
12 | // The dbNP module in which the assay omics data can be found. */ |
---|
13 | AssayModule module |
---|
14 | |
---|
15 | // The assay ID which is used in the dbNP submodule which contains the actual omics data of this assay. |
---|
16 | // This ID is generated in GSCF, but is used in the submodules to refer to this particular Assay. |
---|
17 | String externalAssayID |
---|
18 | |
---|
19 | /** |
---|
20 | * return the domain fields for this domain class |
---|
21 | * @return List |
---|
22 | */ |
---|
23 | static List<TemplateField> giveDomainFields() { return Assay.domainFields } |
---|
24 | static List<TemplateField> domainFields = [ |
---|
25 | new TemplateField( |
---|
26 | name: 'name', |
---|
27 | type: TemplateFieldType.STRING, |
---|
28 | preferredIdentifier: true, |
---|
29 | required: true |
---|
30 | ), |
---|
31 | new TemplateField( |
---|
32 | name: 'module', |
---|
33 | type: TemplateFieldType.MODULE, |
---|
34 | required: true |
---|
35 | ), |
---|
36 | new TemplateField( |
---|
37 | name: 'externalAssayID', |
---|
38 | type: TemplateFieldType.STRING, |
---|
39 | required: true |
---|
40 | ) |
---|
41 | ] |
---|
42 | |
---|
43 | // An Assay always belongs to one study. |
---|
44 | static belongsTo = [parent: Study] |
---|
45 | |
---|
46 | // An Assay can have many samples on which it is performed, but all samples should be within the 'parent' Study. |
---|
47 | static hasMany = [samples: Sample] |
---|
48 | |
---|
49 | static constraints = { |
---|
50 | externalAssayID(nullable:false, blank:false, unique: true) |
---|
51 | } |
---|
52 | |
---|
53 | static mapping = { |
---|
54 | sort "name" |
---|
55 | |
---|
56 | // Workaround for bug http://jira.codehaus.org/browse/GRAILS-6754 |
---|
57 | templateTextFields type: 'text' |
---|
58 | } |
---|
59 | |
---|
60 | def String toString() { |
---|
61 | return name; |
---|
62 | } |
---|
63 | |
---|
64 | def getToken() { |
---|
65 | return externalAssayID |
---|
66 | } |
---|
67 | } |
---|