Changeset 1590


Ignore:
Timestamp:
Mar 4, 2011, 4:28:45 PM (12 years ago)
Author:
work@…
Message:
  • fixing remaining test issues
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/application.properties

    r1584 r1590  
    11#Grails Metadata file
    2 #Thu Mar 03 15:50:23 CET 2011
     2#Fri Mar 04 12:25:51 CET 2011
    33app.build.display.info=0
    44app.build.svn.revision=1079
     
    1313plugins.db-util=0.4
    1414plugins.famfamfam=1.0.1
    15 plugins.gdt=0.0.19
     15plugins.gdt=0.0.20
    1616plugins.grom=0.2.2
    1717plugins.hibernate=1.3.7
  • trunk/grails-app/conf/BootStrap.groovy

    r1588 r1590  
    7070                DatabaseUpgrade.handleUpgrades(dataSource)
    7171
    72                 // developmental bootstrapping:
     72                // developmental/test/demo bootstrapping:
    7373                //      - templates
    7474                //      - ontologies
    7575                //      - and/or studies
    76 
    77 
    7876                if (    grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT ||
    7977                grails.util.GrailsUtil.environment == GrailsApplication.ENV_TEST ||
     
    8583                        if (!Template.count()) ExampleTemplates.initTemplates()
    8684
     85                        // add data required for the webtests?
     86                        if (grails.util.GrailsUtil.environment == GrailsApplication.ENV_TEST) ExampleStudies.addTestData()
     87
    8788                        // add example studies?
    88                         if (!Study.count() && grails.util.GrailsUtil.environment != "demo" && grails.util.GrailsUtil.environment != GrailsApplication.ENV_TEST) ExampleStudies.addExampleStudies(SecUser.findByUsername('user'), SecUser.findByUsername('admin'))
     89                        if (!Study.count() && grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT)
     90                                ExampleStudies.addExampleStudies(SecUser.findByUsername('user'), SecUser.findByUsername('admin'))
    8991                }
    9092
  • trunk/grails-app/conf/BuildConfig.groovy

    r1488 r1590  
    4747//grails.plugin.location.'ajaxflow' = '../ajaxflow'
    4848//grails.plugin.location.'gdt' = '../gdt'
    49 //grails.plugin.location.'bgdt' = '../bgdt'
    5049//grails.plugin.location.'jumpbar' = '../jumpbar'
  • trunk/grails-app/conf/dbnp/configuration/ExampleStudies.groovy

    r1588 r1590  
    2020
    2121class ExampleStudies {
     22        public static void addTestData() {
     23                // get configuration
     24                def config = ConfigurationHolder.config
     25
     26                // Look up the used ontologies which should be in the database by now
     27                def speciesOntology                             = Ontology.getOrCreateOntologyByNcboId(1132)
     28                def brendaOntology                              = Ontology.getOrCreateOntologyByNcboId(1005)
     29                def nciOntology                                 = Ontology.getOrCreateOntologyByNcboId(1032)
     30                def chebiOntology                               = Ontology.getOrCreateOntologyByNcboId(1007)
     31
     32                // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website
     33                def mouseTerm = Term.getOrCreateTerm('Mus musculus',speciesOntology,'10090')
     34                def humanTerm = Term.getOrCreateTerm('Homo sapiens',speciesOntology,'9606')
     35                def arabTerm = Term.getOrCreateTerm('Arabidopsis thaliana',speciesOntology,'3702')
     36                def tomatoTerm = Term.getOrCreateTerm('Solanum lycopersicum',speciesOntology,'4081')
     37                def potatoTerm = Term.getOrCreateTerm('Solanum tuberosum',speciesOntology,'0000')
     38                def bloodTerm = Term.getOrCreateTerm('blood plasma',brendaOntology,'BTO:0000131')
     39                def c57bl6Term = Term.getOrCreateTerm('C57BL/6 Mouse',nciOntology,'C14424')
     40                def glucoseTerm = Term.getOrCreateTerm('glucose',chebiOntology,'CHEBI:17234')
     41
     42                // Add SAM assay reference
     43                def clinicalModule = new AssayModule(
     44                        name: 'SAM module for clinical data',
     45                        platform: 'clinical measurements',
     46                        url: config.modules.sam.url.toString()
     47                ).save(failOnError:true)
     48
     49                // Add metabolomics assay reference
     50                def metabolomicsModule = new AssayModule(
     51                        name: 'Metabolomics module',
     52                        platform: 'GCMS/LCMS',
     53                        url: config.modules.metabolomics.url.toString()
     54                ).save(failOnError:true)
     55
     56                // Add metabolomics assay reference
     57                def metagenomicsModule = new AssayModule(
     58                        name: 'Metagenomics module',
     59                        platform: 'High throughput sequencing',
     60                        url: config.modules.metagenomics.url.toString()
     61                ).save(failOnError:true)
     62        }
    2263
    2364        /**
     
    5192
    5293                // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website
    53                 def mouseTerm = new Term(
    54                         name            : 'Mus musculus',
    55                         ontology        : speciesOntology,
    56                         accession       : '10090'
    57                 ).save(failOnError:true)
    58 
    59                 def humanTerm = new Term(
    60                         name            : 'Homo sapiens',
    61                         ontology        : speciesOntology,
    62                         accession       : '9606'
    63                 ).save(failOnError:true)
    64 
    65                 def arabTerm = new Term(
    66                         name            : 'Arabidopsis thaliana',
    67                         ontology        : speciesOntology,
    68                         accession       : '3702'
    69         ).save(failOnError:true)
    70 
    71                 def tomatoTerm = new Term(
    72                         name            : 'Solanum lycopersicum',
    73                         ontology        : speciesOntology,
    74                         accession       : '4081'
    75         ).save(failOnError:true)
    76 
    77                 def potatoTerm = new Term(
    78                         name            : 'Solanum tuberosum',
    79                         ontology        : speciesOntology,
    80                         accession       : '0000'
    81         ).save(failOnError:true)
    82 
    83                 def bloodTerm = new Term(
    84                         name            : 'blood plasma',
    85                         ontology        : brendaOntology,
    86                         accession       : 'BTO:0000131'
    87         ).save(failOnError:true)
    88 
    89                 def c57bl6Term = new Term(
    90                         name            : 'C57BL/6 Mouse',
    91                         ontology        : nciOntology,
    92                         accession       : 'C14424'
    93         ).save(failOnError:true)
    94 
    95                 def glucoseTerm = new Term(
    96                         name            : 'glucose',
    97                         ontology        : chebiOntology,
    98                         accession       : 'CHEBI:17234'
    99         ).save(failOnError:true)
     94                def mouseTerm = Term.getOrCreateTerm('Mus musculus',speciesOntology,'10090')
     95                def humanTerm = Term.getOrCreateTerm('Homo sapiens',speciesOntology,'9606')
     96                def arabTerm = Term.getOrCreateTerm('Arabidopsis thaliana',speciesOntology,'3702')
     97                def tomatoTerm = Term.getOrCreateTerm('Solanum lycopersicum',speciesOntology,'4081')
     98                def potatoTerm = Term.getOrCreateTerm('Solanum tuberosum',speciesOntology,'0000')
     99                def bloodTerm = Term.getOrCreateTerm('blood plasma',brendaOntology,'BTO:0000131')
     100                def c57bl6Term = Term.getOrCreateTerm('C57BL/6 Mouse',nciOntology,'C14424')
     101                def glucoseTerm = Term.getOrCreateTerm('glucose',chebiOntology,'CHEBI:17234')
    100102
    101103                // Create a few persons, roles and Affiliations
     
    531533    }
    532534}
    533 
    534 //package dbnp.configuration
    535 //
    536 ///**
    537 // * @Author kees
    538 // * @Since Jun 25, 2010
    539 // *
    540 // * Revision information:
    541 // * $Rev$
    542 // * $Author$
    543 // * $Date$
    544 // */
    545 //
    546 //import dbnp.studycapturing.*
    547 //import org.dbnp.gdt.*
    548 //import org.codehaus.groovy.grails.commons.GrailsApplication
    549 //import grails.util.GrailsUtil
    550 //import dbnp.rest.common.CommunicationManager
    551 //import org.codehaus.groovy.grails.commons.*
    552 //
    553 //
    554 //class ExampleStudies {
    555 //
    556 //      /**
    557 //       * Add example studies. This function is meant to be called only in development mode
    558 //       */
    559 //      public static void addExampleStudies(dbnp.authentication.SecUser owner, dbnp.authentication.SecUser otherUser) {
    560 //              "inserting initial studies".grom()
    561 //
    562 //              // get configuration
    563 //              def config = ConfigurationHolder.config
    564 //
    565 //              // Look up the used ontologies which should be in the database by now
    566 //              def speciesOntology                             = Ontology.getOrCreateOntologyByNcboId(1132)
    567 //              def brendaOntology                              = Ontology.getOrCreateOntologyByNcboId(1005)
    568 //              def nciOntology                                 = Ontology.getOrCreateOntologyByNcboId(1032)
    569 //              def chebiOntology                               = Ontology.getOrCreateOntologyByNcboId(1007)
    570 //
    571 //              // Look up the used templates which should also be in the database by now
    572 //              def studyTemplate                               = Template.findByName("Academic study")
    573 //              def mouseTemplate                               = Template.findByName("Mouse")
    574 //              def humanTemplate                               = Template.findByName("Human")
    575 //              def dietTreatmentTemplate               = Template.findByName("Diet treatment")
    576 //              def boostTreatmentTemplate              = Template.findByName("Compound challenge")
    577 //              def liverSamplingEventTemplate  = Template.findByName("Liver extraction")
    578 //              def fastingTreatmentTemplate    = Template.findByName("Fasting treatment")
    579 //              def bloodSamplingEventTemplate  = Template.findByName("Blood extraction")
    580 //              def humanTissueSampleTemplate   = Template.findByName("Human tissue sample")
    581 //              def humanBloodSampleTemplate    = Template.findByName("Human blood sample")
    582 //              def ccAssayTemplate                             = Template.findByName("Clinical chemistry assay")
    583 //              def metAssayTemplate                    = Template.findByName("Metabolomics assay")
    584 //
    585 //              // Add terms manually, to avoid having to do many HTTP requests to the BioPortal website
    586 //              def mouseTerm = new Term(
    587 //                      name            : 'Mus musculus',
    588 //                      ontology        : speciesOntology,
    589 //                      accession       : '10090'
    590 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    591 //
    592 //              def humanTerm = new Term(
    593 //                      name            : 'Homo sapiens',
    594 //                      ontology        : speciesOntology,
    595 //                      accession       : '9606'
    596 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    597 //
    598 //              def arabTerm = new Term(
    599 //                      name            : 'Arabidopsis thaliana',
    600 //                      ontology        : speciesOntology,
    601 //                      accession       : '3702'
    602 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    603 //
    604 //              def tomatoTerm = new Term(
    605 //                      name            : 'Solanum lycopersicum',
    606 //                      ontology        : speciesOntology,
    607 //                      accession       : '4081'
    608 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    609 //
    610 //              def potatoTerm = new Term(
    611 //                      name            : 'Solanum tuberosum',
    612 //                      ontology        : speciesOntology,
    613 //                      accession       : '0000'
    614 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    615 //
    616 //              def bloodTerm = new Term(
    617 //                      name            : 'blood plasma',
    618 //                      ontology        : brendaOntology,
    619 //                      accession       : 'BTO:0000131'
    620 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    621 //
    622 //              def c57bl6Term = new Term(
    623 //                      name            : 'C57BL/6 Mouse',
    624 //                      ontology        : nciOntology,
    625 //                      accession       : 'C14424'
    626 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    627 //
    628 //              def glucoseTerm = new Term(
    629 //                      name            : 'glucose',
    630 //                      ontology        : chebiOntology,
    631 //                      accession       : 'CHEBI:17234'
    632 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    633 //
    634 //              // Create a few persons, roles and Affiliations
    635 //              def affiliation1 = new PersonAffiliation(
    636 //                      institute       : "Science Institute NYC",
    637 //                      department      : "Department of Mathematics"
    638 //              ).save();
    639 //              def affiliation2 = new PersonAffiliation(
    640 //                      institute       : "InfoStats GmbH, Hamburg",
    641 //                      department      : "Life Sciences"
    642 //              ).save();
    643 //              def role1 = new PersonRole(
    644 //                      name            : "Principal Investigator"
    645 //              ).save();
    646 //              def role2 = new PersonRole(
    647 //                      name            : "Statician"
    648 //              ).save();
    649 //
    650 //              // Create persons
    651 //              def person1 = new Person(
    652 //                      lastName        : "Scientist",
    653 //                      firstName       : "John",
    654 //                      gender          : "Male",
    655 //                      initials        : "J.R.",
    656 //                      email           : "john@scienceinstitute.com",
    657 //                      phone           : "1-555-3049",
    658 //                      address         : "First street 2,NYC"
    659 //              ).addToAffiliations(affiliation1).addToAffiliations(affiliation2).save();
    660 //
    661 //              def person2 = new Person(
    662 //                      lastName        : "Statician",
    663 //                      firstName       : "Jane",
    664 //                      gender          : "Female",
    665 //                      initials        : "W.J.",
    666 //                      email           : "jane@statisticalcompany.de",
    667 //                      phone           : "49-555-8291",
    668 //                      address         : "Dritten strasse 38, Hamburg, Germany"
    669 //              ).addToAffiliations(affiliation2).save();
    670 //
    671 //              // Create 30 persons to test pagination
    672 //              def personCounter = 1;
    673 //              30.times {
    674 //                      new Person(
    675 //                              firstName       : "Person #${personCounter}",
    676 //                              lastName        : "Testperson",
    677 //                              email           : "email${personCounter++}@testdomain.com"
    678 //                      ).save()
    679 //              }
    680 //
    681 //              // Create a few publications
    682 //              def publication1 = new Publication(
    683 //                      title           : "Postnatal development of hypothalamic leptin receptors",
    684 //                      authorsList     : "Cottrell EC, Mercer JG, Ozanne SE.",
    685 //                      pubMedID        : "20472140",
    686 //                      comments        : "Not published yet",
    687 //                      DOI                     : "unknown"
    688 //              ).save();
    689 //
    690 //              def publication2 = new Publication(
    691 //                      title           : "Induction of regulatory T cells decreases adipose inflammation and alleviates insulin resistance in ob/ob mice",
    692 //                      authorsList     : "Ilan Y, Maron R, Tukpah AM, Maioli TU, Murugaiyan G, Yang K, Wu HY, Weiner HL.",
    693 //                      pubMedID        : "20445103",
    694 //                      comments        : "",
    695 //                      DOI                     : ""
    696 //              ).save();
    697 //
    698 //              // Add example mouse study
    699 //              def mouseStudy = new Study(
    700 //                      template        : studyTemplate,
    701 //                      title           : "NuGO PPS3 mouse study leptin module",
    702 //                      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.",
    703 //                      code            : "PPS3_leptin_module",
    704 //                      researchQuestion: "Leptin etc.",
    705 //                      ecCode          : "2007117.c",
    706 //                      startDate       : Date.parse('yyyy-MM-dd', '2008-01-02'),
    707 //                      owner           : owner,
    708 //                      readers         : [otherUser]
    709 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    710 //
    711 //              def evLF = new Event(
    712 //                      startTime       : 3600,
    713 //                      endTime         : 3600 + 7 * 24 * 3600,
    714 //                      template        : dietTreatmentTemplate
    715 //              ).setFieldValue('Diet', 'low fat')
    716 //
    717 //              def evHF = new Event(
    718 //                      startTime       : 3600,
    719 //                      endTime         : 3600 + 7 * 24 * 3600,
    720 //                      template        : dietTreatmentTemplate
    721 //              ).setFieldValue('Diet', 'high fat')
    722 //
    723 //              def evBV = new Event(
    724 //                      startTime       : 3600,
    725 //                      endTime         : 3600 + 7 * 24 * 3600,
    726 //                      template        : boostTreatmentTemplate
    727 //              ).setFieldValue('Control', 'true')
    728 //
    729 //              def evBL = new Event(
    730 //                      startTime       : 3600,
    731 //                      endTime         : 3600 + 7 * 24 * 3600,
    732 //                      template        : boostTreatmentTemplate
    733 //              ).setFieldValue('Control', 'false')
    734 //
    735 //              def evLF4 = new Event(
    736 //                      startTime       : 3600,
    737 //                      endTime         : 3600 + 4 * 7 * 24 * 3600,
    738 //                      template        : dietTreatmentTemplate
    739 //              ).setFieldValue('Diet', 'low fat')
    740 //
    741 //              def evHF4 = new Event(
    742 //                      startTime       : 3600,
    743 //                      endTime         : 3600 + 4 * 7 * 24 * 3600,
    744 //                      template        : dietTreatmentTemplate
    745 //              ).setFieldValue('Diet', 'high fat')
    746 //
    747 //              def evBV4 = new Event(
    748 //                      startTime       : 3600,
    749 //                      endTime         : 3600 + 4 * 7 * 24 * 3600,
    750 //                      template        : boostTreatmentTemplate
    751 //              ).setFieldValue('Control', 'true')
    752 //
    753 //              def evBL4 = new Event(
    754 //                      startTime       : 3600,
    755 //                      endTime         : 3600 + 4 * 7 * 24 * 3600,
    756 //                      template        : boostTreatmentTemplate
    757 //              ).setFieldValue('Control', 'false')
    758 //
    759 //              def evS = new SamplingEvent(
    760 //                      startTime       : 3600 + 7 * 24 * 3600,
    761 //                      template        : liverSamplingEventTemplate,
    762 //                      sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F)
    763 //
    764 //              def evS4 = new SamplingEvent(
    765 //                      startTime       : 3600 + 7 * 24 * 3600,
    766 //                      template        : liverSamplingEventTemplate,
    767 //                      sampleTemplate: humanTissueSampleTemplate).setFieldValue('Sample weight', 5F)
    768 //
    769 //              // Add events to study
    770 //              mouseStudy.addToEvents(evLF).addToEvents(evHF).addToEvents(evBV).addToEvents(evBL).addToEvents(evLF4).addToEvents(evHF4).addToEvents(evBV4).addToEvents(evBL4).addToSamplingEvents(evS).addToSamplingEvents(evS4).with { if (!validate()) { errors.each { println it} } else save()}
    771 //
    772 //              // Extra check if the SamplingEvents are saved correctly
    773 //              evS.with { if (!validate()) { errors.each { println it} } else save()}
    774 //              evS4.with { if (!validate()) { errors.each { println it} } else save()}
    775 //
    776 //              def LFBV1 = new EventGroup(name: "10% fat + vehicle for 1 week").addToEvents(evLF).addToEvents(evBV).addToSamplingEvents(evS)
    777 //
    778 //              def LFBL1 = new EventGroup(name: "10% fat + leptin for 1 week").addToEvents(evLF).addToEvents(evBL).addToSamplingEvents(evS)
    779 //
    780 //              def HFBV1 = new EventGroup(name: "45% fat + vehicle for 1 week").addToEvents(evHF).addToEvents(evBV).addToSamplingEvents(evS)
    781 //
    782 //              def HFBL1 = new EventGroup(name: "45% fat + leptin for 1 week").addToEvents(evHF).addToEvents(evBL).addToSamplingEvents(evS)
    783 //
    784 //              def LFBV4 = new EventGroup(name: "10% fat + vehicle for 4 weeks").addToEvents(evLF4).addToEvents(evBV4).addToSamplingEvents(evS4)
    785 //
    786 //              def LFBL4 = new EventGroup(name: "10% fat + leptin for 4 weeks").addToEvents(evLF4).addToEvents(evBL4).addToSamplingEvents(evS4)
    787 //
    788 //              def HFBV4 = new EventGroup(name: "45% fat + vehicle for 4 weeks").addToEvents(evHF4).addToEvents(evBV4).addToSamplingEvents(evS4)
    789 //
    790 //              def HFBL4 = new EventGroup(name: "45% fat + leptin for 4 weeks").addToEvents(evHF4).addToEvents(evBL4).addToSamplingEvents(evS4)
    791 //
    792 //              // Add subjects and samples and compose EventGroups
    793 //              def x = 1
    794 //              80.times {
    795 //                      def currentSubject = new Subject(
    796 //                              name: "A" + x++,
    797 //                              species: mouseTerm,
    798 //                              template: mouseTemplate,
    799 //                      ).setFieldValue("Gender", "Male").setFieldValue("Genotype", c57bl6Term).setFieldValue("Age", 17).setFieldValue("Cage", "" + (int) (x / 2))
    800 //
    801 //                      // We have to save the subject first, otherwise the parentEvent property of the sample cannot be set
    802 //                      // (this is possibly a Grails or Hibernate bug)
    803 //                      mouseStudy.addToSubjects(currentSubject)
    804 //                      currentSubject.with { if (!validate()) { errors.each { println it} } else save()}
    805 //
    806 //                      // Add subject to appropriate EventGroup
    807 //                      if (x > 70) { HFBL4.addToSubjects(currentSubject).save() }
    808 //                      else if (x > 60) { HFBV4.addToSubjects(currentSubject).save() }
    809 //                      else if (x > 50) { LFBL4.addToSubjects(currentSubject).save() }
    810 //                      else if (x > 40) { LFBV4.addToSubjects(currentSubject).save() }
    811 //                      else if (x > 30) { HFBL1.addToSubjects(currentSubject).save() }
    812 //                      else if (x > 20) { HFBV1.addToSubjects(currentSubject).save() }
    813 //                      else if (x > 10) { LFBL1.addToSubjects(currentSubject).save() }
    814 //                      else { LFBV1.addToSubjects(currentSubject).save() }
    815 //
    816 //                      // Create sample
    817 //                      def currentSample = new Sample(
    818 //                              name: currentSubject.name + '_B',
    819 //                              material: bloodTerm,
    820 //                              template: humanBloodSampleTemplate,
    821 //                              parentSubject: currentSubject,
    822 //                              parentEvent: evS //x > 40 ? evS4 : evS
    823 //                      );
    824 //                      mouseStudy.addToSamples(currentSample)
    825 //                      currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    826 //                      currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L))
    827 //              }
    828 //
    829 //              // Add EventGroups to study
    830 //              mouseStudy.addToEventGroups(LFBV1).addToEventGroups(LFBL1).addToEventGroups(HFBV1).addToEventGroups(HFBL1).addToEventGroups(LFBV4).addToEventGroups(LFBL4).addToEventGroups(HFBV4).addToEventGroups(HFBL4).with { if (!validate()) { errors.each { println it} } else save()}
    831 //
    832 //              // Add persons and publications to study
    833 //              def studyperson1 = new StudyPerson(person: person1, role: role1)
    834 //              def studyperson2 = new StudyPerson(person: person2, role: role2)
    835 //
    836 //              mouseStudy.addToPersons(studyperson1).addToPersons(studyperson2).addToPublications(publication1).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()}
    837 //
    838 //              def humanStudy = new Study(
    839 //                      template                : studyTemplate,
    840 //                      title                   : "NuGO PPS human study",
    841 //                      code                    : "PPSH",
    842 //                      researchQuestion: "How much are fasting plasma and urine metabolite levels affected by prolonged fasting ?",
    843 //                      description             : "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U.",
    844 //                      ecCode                  : "unknown",
    845 //                      startDate               : Date.parse('yyyy-MM-dd', '2008-01-14'),
    846 //                      owner                   : owner,
    847 //                      writers                 : [otherUser]
    848 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    849 //
    850 //              def rootGroup = new EventGroup(name: 'Root group');
    851 //
    852 //              def fastingEvent = new Event(
    853 //                      startTime               : 3 * 24 * 3600 + 22 * 3600,
    854 //                      endTime                 : 3 * 24 * 3600 + 30 * 3600,
    855 //                      template                : fastingTreatmentTemplate).setFieldValue('Fasting period', '8h');
    856 //
    857 //              def bloodSamplingEventBefore = new SamplingEvent(
    858 //                      startTime               : 0,
    859 //                      template                : bloodSamplingEventTemplate,
    860 //                      sampleTemplate  : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F);
    861 //
    862 //              def bloodSamplingEventAfter = new SamplingEvent(
    863 //                      startTime               : 3 * 24 * 3600 + 30 * 3600,
    864 //                      template                : bloodSamplingEventTemplate,
    865 //                      sampleTemplate  : humanBloodSampleTemplate).setFieldValue('Sample volume', 4.5F);
    866 //
    867 //              rootGroup.addToEvents fastingEvent
    868 //              rootGroup.addToSamplingEvents bloodSamplingEventBefore
    869 //              rootGroup.addToSamplingEvents bloodSamplingEventAfter
    870 //              rootGroup.save()
    871 //
    872 //              humanStudy.addToEvents(fastingEvent)
    873 //              humanStudy.addToSamplingEvents(bloodSamplingEventBefore)
    874 //              humanStudy.addToSamplingEvents(bloodSamplingEventAfter)
    875 //              humanStudy.addToEventGroups rootGroup
    876 //
    877 //              humanStudy.save()
    878 //
    879 //              def y = 1
    880 //              11.times {
    881 //                      def currentSubject = new Subject(
    882 //                              name            : "" + y++,
    883 //                              species         : humanTerm,
    884 //                              template        : humanTemplate
    885 //                      ).setFieldValue("Gender", (Math.random() > 0.5) ? "Male" : "Female")
    886 //                              //.setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))).setFieldValue("DOB", new Date().parse("dd/mm/yyyy", ((10 + (int) Math.random() * 18) + "/0" + (1 + (int) (Math.random() * 8)) + "/19" + (10 + (int) (Math.random() * 80))))).setFieldValue("Age", 30).setFieldValue("Height", Math.random() * 2F).setFieldValue("Weight", Math.random() * 150F).setFieldValue("BMI", 20 + Math.random() * 10F)
    887 //
    888 //                      humanStudy.addToSubjects(currentSubject)
    889 //                      currentSubject.with { if (!validate()) { errors.each { println it} } else save()}
    890 //
    891 //                      rootGroup.addToSubjects currentSubject
    892 //                      rootGroup.save()
    893 //
    894 //                      def currentSample = new Sample(
    895 //                              name            : currentSubject.name + '_B',
    896 //                              material        : bloodTerm,
    897 //                              template        : humanBloodSampleTemplate,
    898 //                              parentSubject: currentSubject,
    899 //                              parentEvent     : bloodSamplingEventBefore
    900 //                      );
    901 //
    902 //                      humanStudy.addToSamples(currentSample)
    903 //                      currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    904 //                      currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L))
    905 //
    906 //                      currentSample = new Sample(
    907 //                              name            : currentSubject.name + '_A',
    908 //                              material        : bloodTerm,
    909 //                              template        : humanBloodSampleTemplate,
    910 //                              parentSubject: currentSubject,
    911 //                              parentEvent     : bloodSamplingEventAfter
    912 //                      );
    913 //
    914 //                      humanStudy.addToSamples(currentSample)
    915 //                      currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    916 //                      currentSample.setFieldValue("Text on vial", "T" + (Math.random() * 100L))
    917 //              }
    918 //
    919 //              // Add persons to study
    920 //              def studyperson3 = new StudyPerson(person: person1, role: role2)
    921 //              humanStudy.addToPersons(studyperson3).addToPublications(publication2).with { if (!validate()) { errors.each { println it} } else save()}
    922 //
    923 //              // Add SAM assay reference
    924 //              def clinicalModule = new AssayModule(
    925 //                      name: 'SAM module for clinical data',
    926 //                      platform: 'clinical measurements',
    927 //                      url: config.modules.sam.url.toString()
    928 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    929 //
    930 //              // Add metabolomics assay reference
    931 //              def metabolomicsModule = new AssayModule(
    932 //                      name: 'Metabolomics module',
    933 //                      platform: 'GCMS/LCMS',
    934 //                      url: config.modules.metabolomics.url.toString()
    935 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    936 //
    937 //              // Add metabolomics assay reference
    938 //              def metagenomicsModule = new AssayModule(
    939 //                      name: 'Metagenomics module',
    940 //                      platform: 'High throughput sequencing',
    941 //                      url: config.modules.metagenomics.url.toString()
    942 //              ).with { if (!validate()) { errors.each { println it} } else save()}
    943 //
    944 //              def lipidAssayRef = new Assay(
    945 //                      name: 'Lipid profiling',
    946 //                      template: ccAssayTemplate,
    947 //                      module: clinicalModule,
    948 //                      externalAssayID: 'PPS3_SAM'
    949 //              )
    950 //
    951 //              def metAssayRef = new Assay(
    952 //                      name: 'Lipidomics profile',
    953 //                      template: metAssayTemplate,
    954 //                      module: metabolomicsModule,
    955 //                      externalAssayID: 'PPS3_Lipidomics'
    956 //              ).setFieldValue('Spectrometry technique', 'LC/MS')
    957 //
    958 //              mouseStudy.samples*.each {
    959 //                      lipidAssayRef.addToSamples(it)
    960 //                      metAssayRef.addToSamples(it)
    961 //              }
    962 //
    963 //              mouseStudy.addToAssays(lipidAssayRef);
    964 //              mouseStudy.addToAssays(metAssayRef);
    965 //              mouseStudy.save()
    966 //
    967 //              def glucoseAssayBRef = new Assay(
    968 //                      name            : 'Glucose assay before',
    969 //                      template        : ccAssayTemplate,
    970 //                      module          : clinicalModule,
    971 //                      externalAssayID: 'PPSH-Glu-B'
    972 //              )
    973 //
    974 //              def glucoseAssayARef = new Assay(
    975 //                      name            : 'Glucose assay after',
    976 //                      template        : ccAssayTemplate,
    977 //                      module          : clinicalModule,
    978 //                      externalAssayID: 'PPSH-Glu-A'
    979 //              )
    980 //
    981 //              def metAssayRefB = new Assay(
    982 //                      name            : 'Lipidomics profile before',
    983 //                      template        : metAssayTemplate,
    984 //                      module          : metabolomicsModule,
    985 //                      externalAssayID: 'PPSH_Lipidomics_start'
    986 //              ).setFieldValue('Spectrometry technique', 'GC/MS')
    987 //
    988 //              def metAssayRefA = new Assay(
    989 //                      name            : 'Lipidomics profile after',
    990 //                      template        : metAssayTemplate,
    991 //                      module          : metabolomicsModule,
    992 //                      externalAssayID: 'PPSH_Lipidomics_end'
    993 //              ).setFieldValue('Spectrometry technique', 'GC/MS')
    994 //
    995 //
    996 //              // Add sequencing (metagenomics) assays
    997 //              def sequencingAssay16SRef = new Assay(
    998 //                      name            : '16S Sequencing assay',
    999 //                      template        : ccAssayTemplate,
    1000 //                      module          : metagenomicsModule,
    1001 //                      externalAssayID: 'PPSH-SEQ-16S'
    1002 //              )
    1003 //
    1004 //              // Add sequencing (metagenomics) assays
    1005 //              def sequencingAssay18SRef = new Assay(
    1006 //                      name            : '18S Sequencing assay',
    1007 //                      template        : ccAssayTemplate,
    1008 //                      module          : metagenomicsModule,
    1009 //                      externalAssayID: 'PPSH-SEQ-18S'
    1010 //              )
    1011 //
    1012 //              humanStudy.samples*.each {
    1013 //                      if (it.parentEvent.startTime == 0) {
    1014 //                              glucoseAssayBRef.addToSamples(it)
    1015 //                              metAssayRefB.addToSamples(it)
    1016 //                      }
    1017 //                      else {
    1018 //                              glucoseAssayARef.addToSamples(it)
    1019 //                              metAssayRefA.addToSamples(it)
    1020 //                              sequencingAssay16SRef.addToSamples(it)
    1021 //                              sequencingAssay18SRef.addToSamples(it)
    1022 //                      }
    1023 //              }
    1024 //
    1025 //              humanStudy.addToAssays(sequencingAssay16SRef)
    1026 //              humanStudy.addToAssays(sequencingAssay18SRef)
    1027 //              humanStudy.addToAssays(glucoseAssayARef)
    1028 //              humanStudy.addToAssays(glucoseAssayBRef)
    1029 //              humanStudy.addToAssays(metAssayRefA)
    1030 //              humanStudy.addToAssays(metAssayRefB)
    1031 //              humanStudy.save()
    1032 //      }
    1033 //}
  • trunk/grails-app/controllers/HomeController.groovy

    r1585 r1590  
    2626
    2727        def index = {
     28                // got a nostats parameter?
     29                if (params.get('nostats')) {
     30                        session.nostats = (params.get('nostats') == "true") ? true : false
     31                }
     32
    2833                // create sql instance for advanced queries
    2934                def config = ConfigurationHolder.config
     
    9196
    9297                [
     98                        // config
     99                        showstats                                       : (session?.nostats) ? !session.nostats : true,
     100
    93101                        // daily statistics
    94102                        startDate                                       : startDate,
  • trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy

    r1588 r1590  
    3939        def studySelect = { attrs ->
    4040                // Find all studies the user has access to (max 100)
    41                 attrs.from = Study.giveWritableStudies(authenticationService().getLoggedInUser(), 100);
     41                attrs.from = Study.giveWritableStudies(authenticationService.getLoggedInUser(), 100);
    4242
    4343                // got a name?
  • trunk/grails-app/views/home/index.gsp

    r1586 r1590  
    55        <meta property="og:description" content="A generic tool for planning scientific studies, and capturing study meta-data, integrating with analysis platform(s) / LIMS systems and searching relevant studies."/>
    66        <meta name="layout" content="main"/>
    7         <script type="text/javascript" src="${resource(dir: 'js', file: 'highcharts.js')}"></script>
     7        <g:if test="${showstats}"><script type="text/javascript" src="${resource(dir: 'js', file: 'highcharts.js')}"></script></g:if>
    88        <script type="text/javascript" src="${resource(dir: 'js', file: 'jquery.ui.autocomplete.html.js', plugin: 'gdt')}"></script>
    99        <script type="text/javascript">
    10                 Highcharts.theme = { colors: ['#4572A7'] };
    11                 var highchartsOptions = Highcharts.getOptions();
    12                 var studiesPieChart, dailyStatistics;
    13 
    1410                $(document).ready(function() {
     11<g:if test="${showstats}">
     12                        Highcharts.theme = { colors: ['#4572A7'] };
     13                        var highchartsOptions = Highcharts.getOptions();
     14                        var studiesPieChart, dailyStatistics;
     15
    1516                        studiesPieChart = new Highcharts.Chart({
    1617                                chart: {
     
    186187                        });
    187188                        </g:if>
    188 
     189</g:if>
    189190                        $("#search_term").autocomplete({
    190191                                source: function(request, response) {
     
    319320</div>
    320321
    321 
     322<g:if test="${showstats}">
    322323<div style="clear:both;display:block;padding-top:10px;">
    323324        <h1>Usage Statistics</h1>
     
    327328        </div>
    328329</div>
     330</g:if>
    329331
    330332</body>
  • trunk/src/groovy/dbnp/query/Search.groovy

    r1526 r1590  
    1616package dbnp.query
    1717
    18 import nl.grails.plugins.gdt.*
     18import org.dbnp.gdt.*
    1919import java.util.List;
    2020import java.text.DateFormat;
     
    2727
    2828import dbnp.authentication.*
    29 
    30 import org.dbnp.gdt.*
    3129
    3230/**
  • trunk/test/integration/gscf/OntologyTests.groovy

    r1545 r1590  
    7777
    7878                // Create a new term
    79                 def term = new Term(
    80                     name: testTermName,
    81                     accession: testAccession,
    82                     ontology: testOntology
    83                 )
     79                def term = Term.getOrCreateTerm(testTermName, testOntology, testAccession)
    8480
    8581                assert term.validate()
  • trunk/test/integration/gscf/SubjectTests.groovy

    r1545 r1590  
    4848                assert humanTemplate
    4949
    50                 def speciesOntology = Ontology.getOrCreateOntologyByNcboId(1132)
    51                 def humanTerm = new Term(
    52                         name: 'Homo sapiens',
    53                         ontology: speciesOntology,
    54                         accession: '9606')
    55 
    56                 assert humanTerm.validate()
    57                 assert humanTerm.save(flush:true)
    58                 assert humanTerm
     50                def humanTerm = Term.getOrCreateTerm('Homo sapiens',Ontology.getOrCreateOntologyByNcboId(1132),'9606')
     51
     52                //assert humanTerm.validate()
     53                //assert humanTerm.save(flush:true)
     54                //assert humanTerm
    5955
    6056                def subject = new Subject(
  • trunk/test/webtest/gscf/CreateStudyWebTests.groovy

    r1551 r1590  
    11package gscf
    22
    3 
     3import org.dbnp.gdt.*
    44
    55class CreateStudyWebTests extends grails.util.WebTest {
     
    1111
    1212        void testCreateStudy() {
     13                // reset Identity to be able to predict identifiers
     14                Identity.resetIdentifier()
    1315
    1416                // make sure Canoo waits for AJAX calls
    1517                config(easyajax: true)
    1618
    17                 invoke "http://localhost:8080/gscf/"
     19                invoke "http://localhost:8080/gscf/?nostats=true"
    1820                clickLink(description: "Click link: Log In | Register", htmlId: "open")
    1921                setInputField(name: "j_username", value: "user")
     
    5658                clickButton "Add"
    5759                clickButton "add a new eventgroup"
    58                 setCheckbox(name: "event_51_group_49")
    59                 setCheckbox(name: "event_51_group_52")
     60                setCheckbox(name: "event_13_group_11") // 51_49
     61                setCheckbox(name: "event_13_group_14") // 51_52
    6062                setRadioButton(description: "Check radio button eventType: sample", name: "eventType", value: "sample")
    6163                setSelectField(name: "sampleTemplate", text: "Blood extraction")
     
    6668                setInputField(name: "starttime", value: "1w")
    6769                clickButton "Add"
    68                 setCheckbox(name: "event_54_group_49")
    69                 setCheckbox(name: "event_55_group_52")
     70                setCheckbox(name: "event_16_group_11") // 54_49
     71                setCheckbox(name: "event_17_group_14") // 55_52
    7072                setRadioButton(description: "Check radio button eventType: event", name: "eventType", value: "event")
    7173                setSelectField(name: "eventTemplate", text: "Compound challenge")
    7274                setSelectField(name: "compound", text: "glucose")
    7375                clickButton "Add"
    74                 setCheckbox(name: "event_56_group_49")
    75                 setCheckbox(name: "event_56_group_52")
     76                setCheckbox(name: "event_18_group_11")  // 56_49
     77                setCheckbox(name: "event_18_group_14")  // 56_52
    7678
    7779                /* stub to test ontology term widget
     
    8688
    8789                // assign subjects to event groups
    88                 setCheckbox(name: "subject_39_group_49")
    89                 setCheckbox(name: "subject_40_group_49")
    90                 setCheckbox(name: "subject_41_group_49")
    91                 setCheckbox(name: "subject_42_group_52")
    92                 setCheckbox(name: "subject_43_group_52")
    93                 setCheckbox(name: "subject_44_group_52")
     90                setCheckbox(name: "subject_1_group_11") // 39_49
     91                setCheckbox(name: "subject_2_group_11") // 40_49
     92                setCheckbox(name: "subject_3_group_11") // 41_49
     93                setCheckbox(name: "subject_4_group_14") // 42_52
     94                setCheckbox(name: "subject_5_group_14") // 43_52
     95                setCheckbox(name: "subject_6_group_14") // 44_52
    9496                clickButton "next »"
    9597
     
    114116                clickButton "next »"
    115117
    116                 setCheckbox(name: "sample_60_assay_63")
     118                setCheckbox(name: "sample_22_assay_25") // 60_63
    117119                clickButton "next »"
    118120                clickButton "next »"
  • trunk/test/webtest/gscf/EditStudyWebTests.groovy

    r1430 r1590  
    1717
    1818                // login
    19                 invoke "http://localhost:8080/gscf/"
     19                invoke "http://localhost:8080/gscf/?nostats=true"
    2020                clickLink(description: "Click link: Log In | Register", htmlId: "open")
    2121                setInputField(name: "j_username", value: "user")
Note: See TracChangeset for help on using the changeset viewer.