Changeset 139
- Timestamp:
- Jan 27, 2010, 9:58:59 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/application.properties
r130 r139 1 1 #Grails Metadata file 2 # Mon Jan 25 12:50:44 CET 20102 #Tue Jan 26 12:10:14 CET 2010 3 3 app.grails.version=1.2.0 4 4 app.name=gscf 5 5 app.servlet.version=2.4 6 6 app.version=0.1 7 plugins.class-diagram=0.4.18 7 plugins.db-util=0.4 9 8 plugins.hibernate=1.2.0 … … 11 10 plugins.mail=0.9 12 11 plugins.nimble=0.3-SNAPSHOT 12 plugins.searchable=0.5.5 13 13 plugins.shiro=1.0.1 14 14 plugins.tomcat=1.2.0 -
trunk/grails-app/conf/BootStrap.groovy
r138 r139 29 29 shortName: 'Taxon', 30 30 url: 'http://www.obofoundry.org/cgi-bin/detail.cgi?id=ncbi_taxonomy' 31 ).save() 31 ).with { if (!validate()) { errors.each { println it} } else save()} 32 32 33 33 34 // terms … … 36 37 ontology: speciesOntology, 37 38 accession: '10090' 38 ). save()39 ).with { if (!validate()) { errors.each { println it} } else save()} 39 40 def humanTerm = new Term( 40 41 name: 'Homo sapiens', 41 42 ontology: speciesOntology, 42 43 accession: '9606' 43 ).save() 44 ).with { if (!validate()) { errors.each { println it} } else save()} 45 46 def madmaxOntology = new Ontology( 47 name: 'Madmax ontology', 48 shortName: 'MDMX', 49 url: 'madmax.bioinformatics.nl' 50 ).with { if (!validate()) { errors.each { println it} } else save()} 51 52 def treatmentTerm = new Term( 53 name: 'ExperimentalProtocol', 54 ontology: madmaxOntology, 55 accession: 'P-MDMXGE-264' 56 ).with { if (!validate()) { errors.each { println it} } else save()} 57 58 59 def treatmentProtocol = new Protocol( 60 name: 'MADMAX Experimental Protocol', 61 reference: treatmentTerm 62 ).with { if (!validate()) { errors.each { println it} } else save()} 63 64 treatmentProtocol 65 .addToParameters(new ProtocolParameter( 66 name: 'Diet', 67 type: ProtocolParameterType.STRINGLIST, 68 listEntries: ['10% fat (palm oil)','45% fat (palm oil)'])) 69 .addToParameters(new ProtocolParameter( 70 name: 'Compound', 71 type: ProtocolParameterType.STRINGLIST, 72 listEntries: ['Vehicle','Leptin'])) 73 .addToParameters(new ProtocolParameter( 74 name: 'Administration', 75 type: ProtocolParameterType.STRING)) 76 .save() 77 44 78 45 79 // create system user … … 59 93 name: 'Genotype',type: TemplateFieldType.STRINGLIST)) 60 94 .addToSubjectFields(new TemplateSubjectField( 61 name: 'Age',type: TemplateFieldType.NUMBER) 62 ).save() 95 name: 'Gender',type: TemplateFieldType.STRINGLIST)) 96 .addToSubjectFields(new TemplateSubjectField( 97 name: 'Age',type: TemplateFieldType.INTEGER)) 98 .addToSubjectFields(new TemplateSubjectField( 99 name: 'Cage',type: TemplateFieldType.INTEGER)) 100 .with { if (!validate()) { errors.each { println it} } else save()} 101 102 103 //events 104 def eventTreatment = new EventDescription( 105 name: 'Treatment', 106 description: 'Experimental Treatment Protocol NuGO PPS3 leptin module', 107 classification: treatmentTerm, 108 protocol: treatmentProtocol 109 ).with { if (!validate()) { errors.each { println it} } else save()} 63 110 64 111 // studies … … 69 116 description:"C57Bl/6 mice were fed a high fat (45 en%) or low fat (10 en%) diet after a four week run-in on low fat diet. After 1 week 10 mice that received a low fat diet were given an IP leptin challenge and 10 mice of the low-fat group received placebo injections. The same procedure was performed with mice that were fed the high-fat diet. After 4 weeks the procedure was repeated. In total 80 mice were culled.", 70 117 ecCode:"2007117.c", 71 startDate: Date.parse('yyyy-MM-dd','2007-12-11')) 118 startDate: Date.parse('yyyy-MM-dd','2007-12-11') 119 ).with { if (!validate()) { errors.each { println it} } else save()} 120 72 121 def x=1 73 122 12.times { 74 exampleStudy.addToSubjects(new Subject(123 def currentSubject = new Subject( 75 124 name: "A" + x++, 76 125 species: mouseTerm, 77 templateStringFields: ["Genotype" : "C57/Bl6j"], 78 templateNumberFields: ["Age" : 17F] 79 ))} 80 exampleStudy.save() 126 templateStringFields: ["Genotype" : "C57/Bl6j", "Gender" : "Male"], 127 templateNumberFields: ["Age" : 17, "Cage" : (int)(x/2)] 128 ).with { if (!validate()) { errors.each { println it} } else save()} 129 130 exampleStudy.addToSubjects(currentSubject) 131 .addToEvents(new Event( 132 subject: currentSubject, 133 startTime: Date.parse('yyyy-MM-dd','2008-01-07'), 134 endTime: Date.parse('yyyy-MM-dd','2008-01-14'), 135 eventDescription: eventTreatment, 136 parameterStringValues: ['Diet':'10% fat (palm oil)','Compound':'Vehicle','Administration':'intraperitoneal injection']) 137 ).with { if (!validate()) { errors.each { println it} } else save()} 138 } 81 139 82 140 new Study(title:"example",code:"Excode",researchQuestion:"ExRquestion",description:"Exdescription",ecCode:"ExecCode",dateCreated:new Date(),lastUpdated:new Date(),startDate:new Date()).save() -
trunk/grails-app/domain/dbnp/data/Term.groovy
r138 r139 7 7 * The Term object should point to an existing term in an online ontology, therefore instances of this class can also 8 8 * be seen as a cache of elements of the external ontology. 9 *10 * Revision information:11 * $Rev$12 * $Author$13 * $Date$14 9 */ 15 class Term implements Serializable { 16 String name 17 Ontology ontology 18 String accession 10 class Term { 11 static searchable = true 12 String name 13 Ontology ontology 14 String accession 19 15 20 21 16 static constraints = { 17 } 22 18 23 def String toString() { 24 return name 25 } 19 def String toString() { 20 return name 21 } 22 23 26 24 } -
trunk/grails-app/domain/dbnp/studycapturing/Event.groovy
r124 r139 2 2 3 3 import groovy.time.* 4 5 4 6 5 /** … … 11 10 class Event { 12 11 13 Subject subject 14 EventDescription eventDescription 15 Date startTime 16 Date endTime 12 Subject subject 13 EventDescription eventDescription 14 Date startTime 15 Date endTime 16 Map parameterStringValues 17 Map parameterIntegerValues 18 Map parameterFloatValues 19 20 static hasMany = [ 21 parameterStringValues : String, // stores both STRING and STRINGLIST items (latter should be checked against the list) 22 parameterIntegerValues : int, 23 parameterFloatValues : float 24 ] 25 26 // static constraints = { } 27 28 def getDuration() { 29 //endTime - startTime // this is not documented and does not work either 30 // so, it's useless. 31 // thus, do this manually as follows 32 33 def timeMillis = (endTime.getTime() - startTime.getTime()).abs() 34 def days = (timeMillis / (1000 * 60 * 60 * 24)).toInteger() 35 def hours = (timeMillis / (1000 * 60 * 60)).toInteger() 36 def minutes = (timeMillis / (1000 * 60)).toInteger() 37 def seconds = (timeMillis / 1000).toInteger() 38 def millis = (timeMillis % 1000).toInteger() 39 40 return new Duration(days, hours, minutes, seconds, millis) 41 } 17 42 18 43 19 // static constraints = { } 20 def getDuration() { 21 //endTime - startTime // this is not documented and does not work either 22 // so, it's useless. 23 // thus, do this manually as follows 24 25 def timeMillis = (endTime.getTime() - startTime.getTime()).abs() 26 def days = (timeMillis/(1000*60*60*24)).toInteger() 27 def hours = (timeMillis/(1000*60*60)).toInteger() 28 def minutes = (timeMillis/(1000*60)).toInteger() 29 def seconds = (timeMillis/1000).toInteger() 30 def millis = (timeMillis%1000).toInteger() 31 32 return new Duration(days,hours,minutes,seconds,millis) 33 } 34 35 36 def getDurationString() 37 { 38 def d = getDuration() 39 return "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec." 40 } 44 def getDurationString() { 45 def d = getDuration() 46 return "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec." 47 } 41 48 42 49 -
trunk/grails-app/domain/dbnp/studycapturing/EventDescription.groovy
r116 r139 13 13 String description 14 14 Term classification 15 Protocol Instanceprotocol15 Protocol protocol 16 16 17 17 static constraints = { -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolInstance.groovy
r112 r139 1 1 package dbnp.studycapturing 2 3 // this class is now obsolete, should be deleted by Jahn when he's done with Event controller/views 2 4 3 5 /** … … 9 11 10 12 11 // TODO: check how the values can be indexed so that they can be mapped to their respective parameters (should we use maps here?)12 static hasMany = [values : ProtocolParameterInstance]13 13 static constraints = { 14 14 } -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameter.groovy
r114 r139 10 10 11 11 String name 12 String type // development. replace by:ProtocolParameterType type12 ProtocolParameterType type 13 13 String unit 14 14 String description … … 18 18 19 19 static constraints = { 20 unit(nullable: true) 21 reference(nullable: true) 22 description(nullable: true) 20 23 } 21 24 } -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameterInstance.groovy
r115 r139 1 1 package dbnp.studycapturing 2 2 3 // this class is now obsolete, should be deleted by Jahn when he's done with Event controller/views 3 4 class ProtocolParameterInstance { 4 5 -
trunk/grails-app/domain/dbnp/studycapturing/ProtocolParameterType.groovy
r84 r139 6 6 public enum ProtocolParameterType { 7 7 STRING('String'), 8 NUMBER('Number'), 8 INTEGER('Integer number'), 9 FLOAT('Decimal number'), 9 10 STRINGLIST('List') 10 11 … … 16 17 17 18 static list() { 18 [STRING, NUMBER, STRINGLIST]19 [STRING, INTEGER, FLOAT, STRINGLIST] 19 20 } 20 21 -
trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy
r106 r139 7 7 */ 8 8 class Sample { 9 static searchable = true 9 10 10 11 // TODO: should Sample also carry a reference to its parent study, -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r138 r139 10 10 */ 11 11 class Study implements Serializable { 12 static searchable = true 12 13 nimble.User owner 13 14 String title -
trunk/grails-app/domain/dbnp/studycapturing/Subject.groovy
r138 r139 1 1 package dbnp.studycapturing 2 2 3 import dbnp.data.Term 3 4 4 5 /** 5 6 * This domain class describes the subjects in a study. 6 *7 * Revision information:8 * $Rev$9 * $Author$10 * $Date$11 7 */ 12 class Subject implements Serializable { 8 class Subject { 9 static searchable = true 13 10 String name 14 11 Term species 15 12 Map templateStringFields 16 Map template NumberFields17 Map template StringListFields13 Map templateIntegerFields 14 Map templateFloatFields 18 15 Map templateTermFields 19 16 20 17 static hasMany = [ 21 templateStringFields: String,22 template NumberFields: float,23 template StringListFields: String,24 templateTermFields : Term18 templateStringFields : String, // stores both STRING and STRINGLIST items (latter should be checked against the list) 19 templateIntegerFields : int, 20 templateFloatFields : float, 21 templateTermFields : Term 25 22 ] 26 23 27 24 static constraints = { 28 25 } -
trunk/grails-app/domain/dbnp/studycapturing/TemplateFieldType.groovy
r84 r139 6 6 public enum TemplateFieldType { 7 7 STRING('String'), 8 NUMBER('Number'), 9 STRINGLIST('List'), 8 INTEGER('Integer number'), 9 FLOAT('Decimal number'), 10 STRINGLIST('List of items'), 10 11 ONTOLOGYTERM('Ontology Reference') 11 12 … … 17 18 18 19 static list() { 19 [STRING, NUMBER, STRINGLIST, ONTOLOGYTERM]20 [STRING, INTEGER, FLOAT, STRINGLIST, ONTOLOGYTERM] 20 21 } 21 22 -
trunk/grails-app/views/query/index.gsp
r132 r139 17 17 </ul> 18 18 <div id="tab-simple"> 19 <g:form url="[action:' list',controller:'study']">19 <g:form url="[action:'index',controller:'searchable',params: 'q']"> 20 20 <input type="hidden" name="targetUri" value="${targetUri}" /> 21 <label class="grey" for="q uerytext">Search for:</label>22 <input class="field" type="text" name="q uerytext" id="querytext" size="40" />21 <label class="grey" for="q">Search for:</label> 22 <input class="field" type="text" name="q" id="q" size="40" /> 23 23 <input type="submit" name="submit" value="Query"/> 24 24 </g:form> -
trunk/grails-app/views/study/create.gsp
r85 r139 30 30 <tr class="prop"> 31 31 <td valign="top" class="name"> 32 <label for="template "><g:message code="study.template.label" default="Template" /></label>32 <label for="template.id"><g:message code="study.template.label" default="Template" /></label> 33 33 </td> 34 34 <td valign="top" class="value ${hasErrors(bean: studyInstance, field: 'template', 'errors')}"> … … 102 102 <tr class="prop"> 103 103 <td valign="top" class="name"> 104 <label for="owner "><g:message code="study.owner.label" default="Owner" /></label>104 <label for="owner.id"><g:message code="study.owner.label" default="Owner" /></label> 105 105 </td> 106 106 <td valign="top" class="value ${hasErrors(bean: studyInstance, field: 'owner', 'errors')}">
Note: See TracChangeset
for help on using the changeset viewer.