Search in sources :

Example 6 with MappingDetails

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

the class AssociationOperationsServiceTest method createMappingDetails.

@Test
public void createMappingDetails() throws Exception {
    MappingDetails mappingDetails = associationOperationsService.createMappingDetails(ASS_INTER);
    assertThat(mappingDetails).isInstanceOf(MappingDetails.class);
    assertThat(mappingDetails.getMappingDate()).isToday();
    assertThat(mappingDetails.getPerformer()).isEqualTo("test");
}
Also used : MappingDetails(uk.ac.ebi.spot.goci.curation.model.MappingDetails) Test(org.junit.Test)

Example 7 with MappingDetails

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

the class AssociationController method addRowEditMode.

// Add single row to table
@RequestMapping(value = "/associations/{associationId}", params = { "addRow" })
public String addRowEditMode(SnpAssociationStandardMultiForm snpAssociationStandardMultiForm, Model model, @PathVariable Long associationId) {
    snpAssociationStandardMultiForm.getSnpFormRows().add(new SnpFormRow());
    // Pass back updated form
    model.addAttribute("form", snpAssociationStandardMultiForm);
    // Also passes back study object to view so we can create links back to main study page
    Association currentAssociation = associationRepository.findOne(associationId);
    Study associationStudy = currentAssociation.getStudy();
    Long studyId = associationStudy.getId();
    model.addAttribute("study", studyRepository.findOne(studyId));
    // Determine if association is an OR or BETA type
    String measurementType = associationOperationsService.determineIfAssociationIsOrType(currentAssociation);
    model.addAttribute("measurementType", measurementType);
    // Get mapping details
    MappingDetails mappingDetails = associationOperationsService.createMappingDetails(currentAssociation);
    model.addAttribute("mappingDetails", mappingDetails);
    // Return any association errors
    model.addAttribute("errors", associationValidationReportService.generateAssociationWarningsListView(associationId));
    return "edit_multi_snp_association";
}
Also used : SnpFormRow(uk.ac.ebi.spot.goci.curation.model.SnpFormRow) LastViewedAssociation(uk.ac.ebi.spot.goci.curation.model.LastViewedAssociation) MappingDetails(uk.ac.ebi.spot.goci.curation.model.MappingDetails)

Example 8 with MappingDetails

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

the class AssociationController method removeColEditMode.

// Remove column from table
@RequestMapping(value = "/associations/{associationId}", params = { "removeCol" })
public String removeColEditMode(SnpAssociationInteractionForm snpAssociationInteractionForm, HttpServletRequest req, Model model, @PathVariable Long associationId) {
    //Index of value to remove
    final Integer colId = Integer.valueOf(req.getParameter("removeCol"));
    // Remove col
    snpAssociationInteractionForm.getSnpFormColumns().remove(colId.intValue());
    // Pass back updated form
    model.addAttribute("form", snpAssociationInteractionForm);
    // Also passes back study object to view so we can create links back to main study page
    Association currentAssociation = associationRepository.findOne(associationId);
    Study associationStudy = currentAssociation.getStudy();
    Long studyId = associationStudy.getId();
    model.addAttribute("study", studyRepository.findOne(studyId));
    // Determine if association is an OR or BETA type
    String measurementType = associationOperationsService.determineIfAssociationIsOrType(currentAssociation);
    model.addAttribute("measurementType", measurementType);
    // Get mapping details
    MappingDetails mappingDetails = associationOperationsService.createMappingDetails(currentAssociation);
    model.addAttribute("mappingDetails", mappingDetails);
    // Return any association errors
    model.addAttribute("errors", associationValidationReportService.generateAssociationWarningsListView(associationId));
    return "edit_snp_interaction_association";
}
Also used : LastViewedAssociation(uk.ac.ebi.spot.goci.curation.model.LastViewedAssociation) MappingDetails(uk.ac.ebi.spot.goci.curation.model.MappingDetails)

Example 9 with MappingDetails

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

the class MappingDetailsServiceTest method testCreateMappingSummaryForStudyWithNoAssociations.

@Test
public void testCreateMappingSummaryForStudyWithNoAssociations() {
    // Stubbing association repository
    when(associationRepository.findByStudyId(STU_NO_ASS.getId())).thenReturn(Collections.EMPTY_LIST);
    MappingDetails mappingDetails = mappingDetailsService.createMappingSummary(STU_NO_ASS);
    verify(associationRepository, times(1)).findByStudyId(STU_NO_ASS.getId());
    assertThat(mappingDetails).isInstanceOf(MappingDetails.class);
    assertThat(mappingDetails).hasFieldOrPropertyWithValue("mappingDate", null);
    assertThat(mappingDetails).hasFieldOrPropertyWithValue("performer", null);
}
Also used : MappingDetails(uk.ac.ebi.spot.goci.curation.model.MappingDetails) Test(org.junit.Test)

Example 10 with MappingDetails

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

the class MappingDetailsServiceTest method testCreateMappingSummaryForStudyWithAssociationsWithCuratorMapping.

@Test
public void testCreateMappingSummaryForStudyWithAssociationsWithCuratorMapping() {
    // Stubbing association repository
    when(associationRepository.findByStudyId(STU_CURATOR_MAPPING.getId())).thenReturn(Arrays.asList(ASS3, ASS4));
    MappingDetails mappingDetails = mappingDetailsService.createMappingSummary(STU_CURATOR_MAPPING);
    verify(associationRepository, times(1)).findByStudyId(STU_CURATOR_MAPPING.getId());
    assertThat(mappingDetails).isInstanceOf(MappingDetails.class);
    assertThat(mappingDetails).hasFieldOrPropertyWithValue("mappingDate", null);
    assertThat(mappingDetails).hasFieldOrPropertyWithValue("performer", null);
}
Also used : MappingDetails(uk.ac.ebi.spot.goci.curation.model.MappingDetails) Test(org.junit.Test)

Aggregations

MappingDetails (uk.ac.ebi.spot.goci.curation.model.MappingDetails)14 LastViewedAssociation (uk.ac.ebi.spot.goci.curation.model.LastViewedAssociation)7 Test (org.junit.Test)4 SimpleDateFormat (java.text.SimpleDateFormat)3 SnpAssociationForm (uk.ac.ebi.spot.goci.curation.model.SnpAssociationForm)3 SnpFormColumn (uk.ac.ebi.spot.goci.curation.model.SnpFormColumn)3 SnpFormRow (uk.ac.ebi.spot.goci.curation.model.SnpFormRow)3 GetRequest (com.mashape.unirest.request.GetRequest)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 DateFormat (java.text.DateFormat)2 java.util (java.util)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 Valid (javax.validation.Valid)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Qualifier (org.springframework.beans.factory.annotation.Qualifier)2 Value (org.springframework.beans.factory.annotation.Value)2