use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.
the class StudyAncestryService method addAncestry.
public void addAncestry(Long studyId, Ancestry ancestry, SecureUser user) {
Study study = studyRepository.findOne(studyId);
// Set the study for our ancestry and save
ancestry.setStudy(study);
trackingOperationService.create(ancestry, user);
ancestryRepository.save(ancestry);
getLog().info("Ancestry ".concat(ancestry.getId().toString()).concat(" created"));
}
use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.
the class StudyAncestryService method deleteAll.
public void deleteAll(Long studyId, SecureUser user) {
// Get all study ancestry's
Study study = studyRepository.findOne(studyId);
Collection<Ancestry> studyAncestry = ancestryRepository.findByStudyId(studyId);
// Delete ancestry
studyAncestry.forEach(ancestry -> deleteAncestry(ancestry, user));
}
use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.
the class StudyDataService method updateStudyDiseaseTraitByAccessionId.
public Study updateStudyDiseaseTraitByAccessionId(String trait, String accessionId) {
Study study = this.getStudyByAccessionId(accessionId).orElseThrow(() -> new ResourceNotFoundException("Study", accessionId));
DiseaseTrait diseaseTrait = Optional.ofNullable(diseaseTraitRepository.findByTraitIgnoreCase(trait)).orElseThrow(() -> new ResourceNotFoundException("Disease Trait", trait));
study.setDiseaseTrait(diseaseTrait);
studyRepository.save(study);
log.info("Study with accession Id: {} found and updated", accessionId);
return study;
}
use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.
the class StudyFileService method createFileUploadEvent.
/**
* Record file upload event
*
* @param studyId Study ID which is used to find study specific dir
* @param user User carrying out request
*/
public void createFileUploadEvent(Long studyId, SecureUser user) {
Study study = studyRepository.findOne(studyId);
trackingOperationService.update(study, user, "STUDY_FILE_UPLOAD");
studyRepository.save(study);
getLog().info("Study ".concat(String.valueOf(study.getId())).concat(" updated"));
}
use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.
the class BulkOperationsService method flipOpenTargets.
public void flipOpenTargets(Publication publication, SecureUser user) {
Pair<Boolean, Boolean> existingStatus = getFlagStatus(publication);
boolean existingOpenTargets = existingStatus.getLeft();
boolean newOpenTargets = !existingOpenTargets;
getLog().info("[{}] Changing 'Open Targets' flag for {} studies", publication.getPubmedId(), publication.getStudies().size());
List<Long> ids = new ArrayList<>();
for (Study study : publication.getStudies()) {
ids.add(study.getId());
}
for (Long studyId : ids) {
Study existingStudy = studyRepository.findOne(studyId);
existingStudy.setOpenTargets(newOpenTargets);
String updateDescription = "Changed 'Open Targets' flag to: " + Boolean.toString(newOpenTargets);
trackingOperationService.update(existingStudy, user, "STUDY_UPDATE", updateDescription);
studyRepository.save(existingStudy);
getLog().info("Study ".concat(String.valueOf(studyId)).concat(" updated"));
}
}
Aggregations