Search in sources :

Example 6 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method addStudy.

// Save newly added study details
// @ModelAttribute is a reference to the object holding the data entered in the form
@RequestMapping(value = "/new", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.POST)
public synchronized String addStudy(@Valid @ModelAttribute Study study, BindingResult bindingResult, Model model, HttpServletRequest request) throws NoStudyDirectoryException {
    // If we have errors in the fields entered, i.e they are blank, then return these to form so user can fix
    if (bindingResult.hasErrors()) {
        model.addAttribute("study", study);
        // Return an empty pubmedIdForImport object to store user entered pubmed id
        model.addAttribute("pubmedIdForImport", new PubmedIdForImport());
        return "add_study";
    }
    Study savedStudy = studyOperationsService.createStudy(study, currentUserDetailsService.getUserFromRequest(request));
    // Create directory to store associated files
    try {
        studyFileService.createStudyDir(savedStudy.getId());
    } catch (NoStudyDirectoryException e) {
        getLog().error("No study directory exception");
        model.addAttribute("study", savedStudy);
        return "error_pages/study_dir_failure";
    }
    return "redirect:/studies/" + savedStudy.getId();
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) PubmedIdForImport(uk.ac.ebi.spot.goci.curation.model.PubmedIdForImport) NoStudyDirectoryException(uk.ac.ebi.spot.goci.curation.exception.NoStudyDirectoryException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method assignStudyStatus.

// Assign a status to a study
@RequestMapping(value = "/{studyId}/status_update", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.POST)
public String assignStudyStatus(@PathVariable Long studyId, @ModelAttribute StatusAssignment statusAssignment, RedirectAttributes redirectAttributes, HttpServletRequest request) {
    // Find the study and the curator user wishes to assign
    Study study = studyRepository.findOne(studyId);
    if (statusAssignment.getStatusId() == null) {
        String blankStatus = "Cannot assign a blank value as a status for study: " + study.getAuthor() + ", " + " pubmed = " + study.getPubmedId();
        redirectAttributes.addFlashAttribute("blankStatus", blankStatus);
    } else {
        String message = studyOperationsService.assignStudyStatus(study, statusAssignment, currentUserDetailsService.getUserFromRequest(request));
        redirectAttributes.addFlashAttribute("studySnpsNotApproved", message);
    }
    return "redirect:" + statusAssignment.getUri();
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method newStudyForm.

/* New Study:
   *
   * Adding a study is synchronised to ensure the method can only be accessed once.
   *
   * */
// Add a new study
// Directs user to an empty form to which they can create a new study
@RequestMapping(value = "/new", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET)
public String newStudyForm(Model model) {
    model.addAttribute("study", new Study());
    // Return an empty pubmedIdForImport object to store user entered pubmed id
    model.addAttribute("pubmedIdForImport", new PubmedIdForImport());
    return "add_study";
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) PubmedIdForImport(uk.ac.ebi.spot.goci.curation.model.PubmedIdForImport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class SolrIndexer method mapStudies.

Integer mapStudies() {
    Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "publicationDate"));
    Pageable pager = new PageRequest(0, pageSize, sort);
    Page<Study> studyPage = studyService.findPublishedStudies(pager);
    studyMapper.map(studyPage.getContent());
    while (studyPage.hasNext()) {
        if (maxPages != -1 && studyPage.getNumber() >= maxPages - 1) {
            break;
        }
        pager = pager.next();
        studyPage = studyService.findPublishedStudies(pager);
        studyMapper.map(studyPage.getContent());
        if (sysOutLogging) {
            System.out.print(".");
        }
    }
    return (int) studyPage.getTotalElements();
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) PageRequest(org.springframework.data.domain.PageRequest) Pageable(org.springframework.data.domain.Pageable) Sort(org.springframework.data.domain.Sort)

Example 10 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class DefaultGWASOWLPublisher method validateGWASData.

/**
     * Validates the data obtained from the GWAS catalog (prior to converting to OWL)
     *
     * @param studies the set of studies to validate
     */
protected void validateGWASData(Collection<Study> studies) {
    // now check a random assortment of 5 studies for trait associations, abandoning broken ones
    int count = 0;
    int noAssocCount = 0;
    int termMismatches = 0;
    for (Study study : studies) {
        //            try {
        Collection<Association> associations = study.getAssociations();
        getLog().debug("Study (PubMed ID '" + study.getPubmedId() + "') had " + associations.size() + " associations");
        if (associations.size() > 0) {
            for (Association association : associations) {
                String efoTraitsDashSepList = "";
                for (EfoTrait efoTrait : association.getEfoTraits()) {
                    if ("".equals(efoTraitsDashSepList)) {
                        efoTraitsDashSepList.concat(efoTrait.getTrait());
                    } else {
                        efoTraitsDashSepList.concat(", " + efoTrait.getTrait());
                    }
                }
                for (Locus locus : association.getLoci()) {
                    for (RiskAllele riskAllele : locus.getStrongestRiskAlleles()) {
                        getLog().debug(//                                "    Association: SNP '" + association.getAssociatedSNP().getRSID() +
                        "    Association: SNP '" + riskAllele.getSnp().getRsId() + "' <-> Trait '" + efoTraitsDashSepList.toString() + "'");
                    }
                }
            }
            count++;
        } else {
            noAssocCount++;
        }
    }
    int eligCount = studies.size() - noAssocCount;
    int correctCount = count + termMismatches;
    getLog().info("\n\nREPORT:\n" + eligCount + "/" + studies.size() + " declared associations and therefore could usefully be mapped.\n" + (eligCount - count - termMismatches) + "/" + eligCount + " failed due to data integrity concerns.\n" + count + "/" + correctCount + " studies could be completely mapped after passing all checks.\n" + termMismatches + "/" + correctCount + " failed due to missing or duplicated terms in EFO");
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) Association(uk.ac.ebi.spot.goci.model.Association) RiskAllele(uk.ac.ebi.spot.goci.model.RiskAllele) EfoTrait(uk.ac.ebi.spot.goci.model.EfoTrait) Locus(uk.ac.ebi.spot.goci.model.Locus)

Aggregations

Study (uk.ac.ebi.spot.goci.model.Study)44 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)20 ArrayList (java.util.ArrayList)7 Association (uk.ac.ebi.spot.goci.model.Association)7 Housekeeping (uk.ac.ebi.spot.goci.model.Housekeeping)6 MultiStudyNoteForm (uk.ac.ebi.spot.goci.curation.model.MultiStudyNoteForm)5 Date (java.util.Date)4 Test (org.junit.Test)4 Ancestry (uk.ac.ebi.spot.goci.model.Ancestry)4 NoteSubject (uk.ac.ebi.spot.goci.model.NoteSubject)4 SecureUser (uk.ac.ebi.spot.goci.model.SecureUser)4 SingleNucleotidePolymorphism (uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism)4 ParseException (java.text.ParseException)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Service (org.springframework.stereotype.Service)3 StudyNoteForm (uk.ac.ebi.spot.goci.curation.model.StudyNoteForm)3 RiskAllele (uk.ac.ebi.spot.goci.model.RiskAllele)3 StudyNote (uk.ac.ebi.spot.goci.model.StudyNote)3 IOException (java.io.IOException)2