Search in sources :

Example 16 with Association

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

the class SolrIndexer method mapAssociations.

Integer mapAssociations() {
    Sort sort = new Sort(new Sort.Order("id"));
    Pageable pager = new PageRequest(0, pageSize, sort);
    Page<Association> associationPage = associationService.findPublishedAssociations(pager);
    associationMapper.map(associationPage.getContent());
    while (associationPage.hasNext()) {
        if (maxPages != -1 && associationPage.getNumber() >= maxPages - 1) {
            break;
        }
        pager = pager.next();
        associationPage = associationService.findPublishedAssociations(pager);
        associationMapper.map(associationPage.getContent());
        if (sysOutLogging) {
            System.out.print(".");
        }
    }
    return (int) associationPage.getTotalElements();
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) Pageable(org.springframework.data.domain.Pageable) Association(uk.ac.ebi.spot.goci.model.Association) Sort(org.springframework.data.domain.Sort)

Example 17 with Association

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

the class DataDeletionService method deleteStudy.

private void deleteStudy(Study study) {
    System.out.println("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t" + study.getAssociations().size() + "\t association and \t" + study.getAncestries().size() + "\t ancestries");
    getLog().debug("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t" + study.getAssociations().size() + "\t association and \t" + study.getAncestries().size() + "\t ancestries");
    Collection<Association> associations = study.getAssociations();
    associations.forEach(this::deleteAssociation);
    Collection<Ancestry> ancestries = ancestryRepository.findByStudyId(study.getId());
    for (Ancestry ancestry : ancestries) {
        ancestryRepository.delete(ancestry);
    }
    // WeeklyTracking, CuratorTracking and Note. Please use this method!
    // Shared with === DataDeletionService ===
    studyService.deleteRelatedInfoByStudy(study);
    // Delete study
    studyService.deleteByStudyId(study.getId());
}
Also used : Association(uk.ac.ebi.spot.goci.model.Association) Ancestry(uk.ac.ebi.spot.goci.model.Ancestry)

Example 18 with Association

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

the class MapCatalogService method mapCatalogContentsByAssociations.

// This method should be refactor with mapCatalogContentsNight
public void mapCatalogContentsByAssociations(String performer, Collection<Association> associations) throws EnsemblMappingException {
    Collection<Association> associationsToMap = associationService.findAssociationAssociationData(associations);
    getLog().info("Mapping all associations in database, total number: " + associationsToMap.size());
    try {
        mappingService.validateAndMapAllAssociations(associationsToMap, performer);
    } catch (EnsemblMappingException e) {
        throw new EnsemblMappingException("Attempt to map all associations failed", e);
    }
}
Also used : Association(uk.ac.ebi.spot.goci.model.Association) EnsemblMappingException(uk.ac.ebi.spot.goci.exception.EnsemblMappingException)

Example 19 with Association

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

the class MapCatalogService method mapCatalogContents.

/**
     * Get all associations in database and map
     *
     * @param performer name of curator/job carrying out the mapping
     */
public void mapCatalogContents(String performer) throws EnsemblMappingException {
    // Get all old association reports so we can compare with new ones, do this before we remap
    Collection<AssociationReport> oldAssociationReports = associationReportRepository.findAll();
    // Get all associations via service
    Collection<Association> associations = associationService.findAllAssociations();
    getLog().info("Mapping all associations in database, total number: " + associations.size());
    try {
        mappingService.validateAndMapAllAssociations(associations, performer);
    } catch (EnsemblMappingException e) {
        throw new EnsemblMappingException("Attempt to map all associations failed", e);
    }
    mappingErrorComparisonService.compareOldVersusNewErrors(oldAssociationReports, false, 0, 0);
}
Also used : Association(uk.ac.ebi.spot.goci.model.Association) AssociationReport(uk.ac.ebi.spot.goci.model.AssociationReport) EnsemblMappingException(uk.ac.ebi.spot.goci.exception.EnsemblMappingException)

Example 20 with Association

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

the class MapCatalogService method mapCatalogContentsNight.

public void mapCatalogContentsNight(String performer) throws EnsemblMappingException {
    Collection<Association> associations = associationService.findAssociationToMap();
    getLog().info("Mapping all associations in database, total number: " + associations.size());
    try {
        mappingService.validateAndMapAllAssociations(associations, performer);
    } catch (EnsemblMappingException e) {
        throw new EnsemblMappingException("Attempt to map all associations failed", e);
    }
}
Also used : Association(uk.ac.ebi.spot.goci.model.Association) EnsemblMappingException(uk.ac.ebi.spot.goci.exception.EnsemblMappingException)

Aggregations

Association (uk.ac.ebi.spot.goci.model.Association)38 ArrayList (java.util.ArrayList)14 SingleNucleotidePolymorphism (uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism)10 RiskAllele (uk.ac.ebi.spot.goci.model.RiskAllele)9 Study (uk.ac.ebi.spot.goci.model.Study)7 Test (org.junit.Test)6 Gene (uk.ac.ebi.spot.goci.model.Gene)6 SimpleDateFormat (java.text.SimpleDateFormat)5 EnsemblMappingException (uk.ac.ebi.spot.goci.exception.EnsemblMappingException)5 Locus (uk.ac.ebi.spot.goci.model.Locus)5 EfoTrait (uk.ac.ebi.spot.goci.model.EfoTrait)4 Filter (uk.ac.ebi.spot.goci.pussycat.lang.Filter)4 Collection (java.util.Collection)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Service (org.springframework.stereotype.Service)3 IOException (java.io.IOException)2 URI (java.net.URI)2 DateFormat (java.text.DateFormat)2 ParseException (java.text.ParseException)2 Date (java.util.Date)2