use of uk.ac.ebi.spot.goci.curation.model.SnpFormRow in project goci by EBISPOT.
the class AssociationController method addRow.
// Add single row to table
@RequestMapping(value = "/studies/{studyId}/associations/add_multi", params = { "addRow" })
public String addRow(SnpAssociationStandardMultiForm snpAssociationStandardMultiForm, Model model, @PathVariable Long studyId, @RequestParam(required = true) String measurementType) {
snpAssociationStandardMultiForm.getSnpFormRows().add(new SnpFormRow());
// Pass back required attributes
model.addAttribute("form", snpAssociationStandardMultiForm);
model.addAttribute("measurementType", measurementType);
model.addAttribute("study", studyRepository.findOne(studyId));
return "add_multi_snp_association";
}
use of uk.ac.ebi.spot.goci.curation.model.SnpFormRow in project goci by EBISPOT.
the class AssociationController method addStandardSnpsView.
// Generate a empty form page to add standard snp
@RequestMapping(value = "/studies/{studyId}/associations/add_standard", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET)
public String addStandardSnpsView(Model model, @PathVariable Long studyId, @RequestParam(required = true) String measurementType) {
// Return form object
SnpAssociationStandardMultiForm emptyForm = new SnpAssociationStandardMultiForm();
// Add one row by default and set description
emptyForm.getSnpFormRows().add(new SnpFormRow());
// Measurement type determines whether we render a OR/Beta form
model.addAttribute("form", emptyForm);
model.addAttribute("measurementType", measurementType);
// Also passes back study object to view so we can create links back to main study page
model.addAttribute("study", studyRepository.findOne(studyId));
return "add_standard_snp_association";
}
use of uk.ac.ebi.spot.goci.curation.model.SnpFormRow in project goci by EBISPOT.
the class AssociationController method addRows.
// Add multiple rows to table
@RequestMapping(value = "/studies/{studyId}/associations/add_multi", params = { "addRows" })
public String addRows(SnpAssociationStandardMultiForm snpAssociationStandardMultiForm, Model model, @PathVariable Long studyId, @RequestParam(required = true) String measurementType) {
Integer numberOfRows = snpAssociationStandardMultiForm.getMultiSnpHaplotypeNum();
// Add number of rows curator selected
while (numberOfRows != 0) {
snpAssociationStandardMultiForm.getSnpFormRows().add(new SnpFormRow());
numberOfRows--;
}
// Pass back required attributes
model.addAttribute("measurementType", measurementType);
model.addAttribute("form", snpAssociationStandardMultiForm);
model.addAttribute("study", studyRepository.findOne(studyId));
return "add_multi_snp_association";
}
use of uk.ac.ebi.spot.goci.curation.model.SnpFormRow in project goci by EBISPOT.
the class SingleSnpMultiSnpAssociationServiceTest method testCreateSingleForm.
@Test
public void testCreateSingleForm() throws Exception {
assertThat(snpAssociationFormService.createForm(BETA_SINGLE_ASSOCIATION)).isInstanceOf(SnpAssociationStandardMultiForm.class);
SnpAssociationStandardMultiForm form = (SnpAssociationStandardMultiForm) snpAssociationFormService.createForm(BETA_SINGLE_ASSOCIATION);
// Check values we would expect in form
assertThat(form.getAssociationId()).as("Check form ID").isEqualTo(BETA_SINGLE_ASSOCIATION.getId());
assertThat(form.getBetaDirection()).as("Check form BETA DIRECTION").isEqualTo(BETA_SINGLE_ASSOCIATION.getBetaDirection());
assertThat(form.getBetaUnit()).as("Check form BETA UNIT").isEqualTo(BETA_SINGLE_ASSOCIATION.getBetaUnit());
assertThat(form.getBetaNum()).as("Check form BETA NUM").isEqualTo(BETA_SINGLE_ASSOCIATION.getBetaNum());
assertThat(form.getSnpType()).as("Check form SNP TYPE").isEqualTo(BETA_SINGLE_ASSOCIATION.getSnpType());
assertThat(form.getMultiSnpHaplotype()).as("Check form MULTI SNP HAPLOTYPE").isEqualTo(BETA_SINGLE_ASSOCIATION.getMultiSnpHaplotype());
assertThat(form.getSnpApproved()).as("Check form SNP APPROVED").isEqualTo(BETA_SINGLE_ASSOCIATION.getSnpApproved());
assertThat(form.getPvalueExponent()).as("Check form PVALUE EXPONENT").isEqualTo(BETA_SINGLE_ASSOCIATION.getPvalueExponent());
assertThat(form.getPvalueMantissa()).as("Check form PVALUE MANTISSA").isEqualTo(BETA_SINGLE_ASSOCIATION.getPvalueMantissa());
assertThat(form.getStandardError()).as("Check form STANDARD ERROR").isEqualTo(BETA_SINGLE_ASSOCIATION.getStandardError());
assertThat(form.getRange()).as("Check form RANGE").isEqualTo(BETA_SINGLE_ASSOCIATION.getRange());
assertThat(form.getPvalueDescription()).as("Check form PVALUE DESCRIPTION").isEqualTo(BETA_SINGLE_ASSOCIATION.getPvalueDescription());
assertThat(form.getRiskFrequency()).as("Check form RISK FREQUENCY").isEqualTo(BETA_SINGLE_ASSOCIATION.getRiskFrequency());
assertThat(form.getDescription()).as("Check form DESCRIPTION").isEqualTo(BETA_SINGLE_ASSOCIATION.getDescription());
// Check EFO traits
assertThat(form.getEfoTraits()).extracting("id", "trait", "uri").contains(tuple(988L, "atrophic rhinitis", "http://www.ebi.ac.uk/efo/EFO_0007159"), tuple(989L, "HeLa", "http://www.ebi.ac.uk/efo/EFO_0001185"));
// Check null values
assertNull(form.getOrPerCopyNum());
assertNull(form.getOrPerCopyRecip());
assertNull(form.getOrPerCopyRecipRange());
assertNull(form.getMultiSnpHaplotypeNum());
// Test locus attributes
assertThat(form.getMultiSnpHaplotypeDescr()).as("Check form MULTI HAPLOTYPE DESCRIPTION").isEqualTo("Single variant");
assertThat(form.getAuthorReportedGenes()).isInstanceOf(Collection.class);
assertThat(form.getAuthorReportedGenes()).contains("NEGR1", "FRS2");
// Test the row values
Collection<SnpFormRow> rows = form.getSnpFormRows();
assertThat(rows).hasSize(1);
assertThat(rows).extracting("snp", "strongestRiskAllele", "proxySnps").containsExactly(tuple("rs579459", "rs579459-?", Collections.singletonList("rs6538678")));
}
use of uk.ac.ebi.spot.goci.curation.model.SnpFormRow 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";
}
Aggregations