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();
}
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();
}
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";
}
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();
}
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");
}
Aggregations