Search in sources :

Example 6 with SnpAssociationInteractionForm

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

the class SnpInteractionAssociationServiceTest method testCreateInteractionForm.

@Test
public void testCreateInteractionForm() throws Exception {
    assertThat(snpAssociationFormService.createForm(OR_INTERACTION_ASSOCIATION)).isInstanceOf(SnpAssociationInteractionForm.class);
    SnpAssociationInteractionForm form = (SnpAssociationInteractionForm) snpAssociationFormService.createForm(OR_INTERACTION_ASSOCIATION);
    // Check values we would expect in form
    assertThat(form.getAssociationId()).as("Check form ID").isEqualTo(OR_INTERACTION_ASSOCIATION.getId());
    assertThat(form.getSnpType()).as("Check form SNP TYPE").isEqualTo(OR_INTERACTION_ASSOCIATION.getSnpType());
    assertThat(form.getSnpApproved()).as("Check form SNP APPROVED").isEqualTo(OR_INTERACTION_ASSOCIATION.getSnpApproved());
    assertThat(form.getPvalueExponent()).as("Check form PVALUE EXPONENT").isEqualTo(OR_INTERACTION_ASSOCIATION.getPvalueExponent());
    assertThat(form.getPvalueMantissa()).as("Check form PVALUE MANTISSA").isEqualTo(OR_INTERACTION_ASSOCIATION.getPvalueMantissa());
    assertThat(form.getStandardError()).as("Check form STANDARD ERROR").isEqualTo(OR_INTERACTION_ASSOCIATION.getStandardError());
    assertThat(form.getRange()).as("Check form RANGE").isEqualTo(OR_INTERACTION_ASSOCIATION.getRange());
    assertThat(form.getPvalueDescription()).as("Check form PVALUE DESCRIPTION").isEqualTo(OR_INTERACTION_ASSOCIATION.getPvalueDescription());
    assertThat(form.getRiskFrequency()).as("Check form RISK FREQUENCY").isEqualTo(OR_INTERACTION_ASSOCIATION.getRiskFrequency());
    assertThat(form.getDescription()).as("Check form DESCRIPTION").isEqualTo(OR_INTERACTION_ASSOCIATION.getDescription());
    // Check EFO traits
    assertThat(form.getEfoTraits()).extracting("id", "trait", "uri").contains(tuple(1001L, "atrophic rhinitis", "http://www.ebi.ac.uk/efo/EFO_0007159"), tuple(1002L, "HeLa", "http://www.ebi.ac.uk/efo/EFO_0001185"));
    // Check null values
    assertNull(form.getBetaNum());
    assertNull(form.getBetaUnit());
    assertNull(form.getBetaDirection());
    // Test locus attributes
    assertThat(form.getNumOfInteractions()).as("Check form NUMBER OF INTERACTIONS").isEqualTo(2);
    // Test the column values
    Collection<SnpFormColumn> columns = form.getSnpFormColumns();
    assertThat(columns).hasSize(2);
    assertThat(columns).extracting("snp", "strongestRiskAllele", "riskFrequency", "authorReportedGenes", "proxySnps", "genomeWide", "limitedList").contains(tuple("rs9788721", "rs9788721-?", "0.6", Collections.singletonList("WBP4"), Collections.emptyList(), true, false), tuple("rs8042374", "rs8042374-?", "0.4", Collections.singletonList("SLC25A15"), Collections.emptyList(), true, false));
}
Also used : SnpAssociationInteractionForm(uk.ac.ebi.spot.goci.curation.model.SnpAssociationInteractionForm) SnpFormColumn(uk.ac.ebi.spot.goci.curation.model.SnpFormColumn) Test(org.junit.Test)

Aggregations

SnpAssociationInteractionForm (uk.ac.ebi.spot.goci.curation.model.SnpAssociationInteractionForm)6 SnpFormColumn (uk.ac.ebi.spot.goci.curation.model.SnpFormColumn)5 GetRequest (com.mashape.unirest.request.GetRequest)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 DateFormat (java.text.DateFormat)3 SimpleDateFormat (java.text.SimpleDateFormat)3 java.util (java.util)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Valid (javax.validation.Valid)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Qualifier (org.springframework.beans.factory.annotation.Qualifier)3 Value (org.springframework.beans.factory.annotation.Value)3 Sort (org.springframework.data.domain.Sort)3 MediaType (org.springframework.http.MediaType)3 Controller (org.springframework.stereotype.Controller)3 Model (org.springframework.ui.Model)3