@Test public void checkSnpGeneLocation() throws Exception { when(snpCheckingRestService.getSnpLocations("rs7329174","")).thenReturn(Collections.singleton("13")); when(snpCheckingRestService.getSnpLocations("rs1234","")).thenReturn(Collections.EMPTY_SET); when(snpCheckingRestService.getSnpLocations("rs11894081","")).thenReturn(Collections.singleton("X")); when(geneCheckingRestService.getGeneLocation("ELF1","")).thenReturn("13"); when(snpCheckingRestService.checkSnpIdentifierIsValid("rs7329174","")).thenReturn(null); when(geneCheckingRestService.checkGeneSymbolIsValid("ELF1","")).thenReturn(null); when(snpCheckingRestService.checkSnpIdentifierIsValid("MADEUPSNP","")).thenReturn( "SNP identifier MADEUPSNP is not valid"); assertThat(validationChecks.checkSnpGeneLocation("rs7329174", "ELF1","")).isNull(); assertThat(validationChecks.checkSnpGeneLocation("MADEUPSNP", "ELF1","")).isEqualTo( "SNP identifier MADEUPSNP is not valid"); assertThat(validationChecks.checkSnpGeneLocation("rs1234", "SFRP1","")).isEqualTo( "SNP rs1234 has no location details, cannot check if gene is on same chromosome as SNP"); assertThat(validationChecks.checkSnpGeneLocation("rs11894081", "ELF1","")).isEqualTo( "Gene ELF1 and SNP rs11894081 are not on same chromosome"); assertThat(validationChecks.checkSnpGeneLocation("rs7329174", "intergenic","")).isNull(); }
public String checkSnpGeneLocation(String snp, String gene, String eRelease) { String error = null; String snpError = checkSnp(snp, eRelease); if (snpError != null) { error = snpError; } else { Set<String> snpChromosomeNames = snpCheckingRestService.getSnpLocations(snp, eRelease); if (!snpChromosomeNames.isEmpty()) { if (!gene.equalsIgnoreCase("intergenic") && !gene.equalsIgnoreCase("NR")) { String geneChromosome = geneCheckingRestService.getGeneLocation(gene, eRelease); if (!snpChromosomeNames.contains(geneChromosome)) { error = "Gene ".concat(gene) .concat(" and SNP ") .concat(snp) .concat(" are not on same chromosome"); } } } else { error = "SNP ".concat(snp) .concat(" has no location details, cannot check if gene is on same chromosome as SNP"); } } return error; }
ValidationChecks { public String checkSnpGeneLocation(String snp, String gene, String eRelease) { String error = null; String snpError = checkSnp(snp, eRelease); if (snpError != null) { error = snpError; } else { Set<String> snpChromosomeNames = snpCheckingRestService.getSnpLocations(snp, eRelease); if (!snpChromosomeNames.isEmpty()) { if (!gene.equalsIgnoreCase("intergenic") && !gene.equalsIgnoreCase("NR")) { String geneChromosome = geneCheckingRestService.getGeneLocation(gene, eRelease); if (!snpChromosomeNames.contains(geneChromosome)) { error = "Gene ".concat(gene) .concat(" and SNP ") .concat(snp) .concat(" are not on same chromosome"); } } } else { error = "SNP ".concat(snp) .concat(" has no location details, cannot check if gene is on same chromosome as SNP"); } } return error; } }
ValidationChecks { public String checkSnpGeneLocation(String snp, String gene, String eRelease) { String error = null; String snpError = checkSnp(snp, eRelease); if (snpError != null) { error = snpError; } else { Set<String> snpChromosomeNames = snpCheckingRestService.getSnpLocations(snp, eRelease); if (!snpChromosomeNames.isEmpty()) { if (!gene.equalsIgnoreCase("intergenic") && !gene.equalsIgnoreCase("NR")) { String geneChromosome = geneCheckingRestService.getGeneLocation(gene, eRelease); if (!snpChromosomeNames.contains(geneChromosome)) { error = "Gene ".concat(gene) .concat(" and SNP ") .concat(snp) .concat(" are not on same chromosome"); } } } else { error = "SNP ".concat(snp) .concat(" has no location details, cannot check if gene is on same chromosome as SNP"); } } return error; } @Autowired  ValidationChecks(GeneCheckingRestService geneCheckingRestService,
                            SnpCheckingRestService snpCheckingRestService); }
ValidationChecks { public String checkSnpGeneLocation(String snp, String gene, String eRelease) { String error = null; String snpError = checkSnp(snp, eRelease); if (snpError != null) { error = snpError; } else { Set<String> snpChromosomeNames = snpCheckingRestService.getSnpLocations(snp, eRelease); if (!snpChromosomeNames.isEmpty()) { if (!gene.equalsIgnoreCase("intergenic") && !gene.equalsIgnoreCase("NR")) { String geneChromosome = geneCheckingRestService.getGeneLocation(gene, eRelease); if (!snpChromosomeNames.contains(geneChromosome)) { error = "Gene ".concat(gene) .concat(" and SNP ") .concat(snp) .concat(" are not on same chromosome"); } } } else { error = "SNP ".concat(snp) .concat(" has no location details, cannot check if gene is on same chromosome as SNP"); } } return error; } @Autowired  ValidationChecks(GeneCheckingRestService geneCheckingRestService,
                            SnpCheckingRestService snpCheckingRestService); String checkValueIsPresent(String value); String checkValueIsEmpty(String value); String checkValueIsEmpty(Float value); String checkSnpType(String value); String checkOrIsPresent(Float value); String checkOrRecipIsPresentAndLessThanOne(Float value); String checkOrAndOrRecip(Float or, Float orRecip); String checkBetaIsPresentAndIsNotNegative(Float value); String checkBetaDirectionIsPresent(String value); String checkMantissaIsLessThan10(Integer value); String checkExponentIsPresentAndNegative(Integer value); String checkGene(String geneName, String eRelease); String checkSnp(String snp, String eRelease); String checkSnpGeneLocation(String snp, String gene, String eRelease); String checkRiskAllele(String riskAlleleName); String checkRiskFrequency(String riskFrequency); String checkSynthax(String value, String delimiter); String checkSnpStatus(Boolean genomeWide, Boolean limitedList); }
ValidationChecks { public String checkSnpGeneLocation(String snp, String gene, String eRelease) { String error = null; String snpError = checkSnp(snp, eRelease); if (snpError != null) { error = snpError; } else { Set<String> snpChromosomeNames = snpCheckingRestService.getSnpLocations(snp, eRelease); if (!snpChromosomeNames.isEmpty()) { if (!gene.equalsIgnoreCase("intergenic") && !gene.equalsIgnoreCase("NR")) { String geneChromosome = geneCheckingRestService.getGeneLocation(gene, eRelease); if (!snpChromosomeNames.contains(geneChromosome)) { error = "Gene ".concat(gene) .concat(" and SNP ") .concat(snp) .concat(" are not on same chromosome"); } } } else { error = "SNP ".concat(snp) .concat(" has no location details, cannot check if gene is on same chromosome as SNP"); } } return error; } @Autowired  ValidationChecks(GeneCheckingRestService geneCheckingRestService,
                            SnpCheckingRestService snpCheckingRestService); String checkValueIsPresent(String value); String checkValueIsEmpty(String value); String checkValueIsEmpty(Float value); String checkSnpType(String value); String checkOrIsPresent(Float value); String checkOrRecipIsPresentAndLessThanOne(Float value); String checkOrAndOrRecip(Float or, Float orRecip); String checkBetaIsPresentAndIsNotNegative(Float value); String checkBetaDirectionIsPresent(String value); String checkMantissaIsLessThan10(Integer value); String checkExponentIsPresentAndNegative(Integer value); String checkGene(String geneName, String eRelease); String checkSnp(String snp, String eRelease); String checkSnpGeneLocation(String snp, String gene, String eRelease); String checkRiskAllele(String riskAlleleName); String checkRiskFrequency(String riskFrequency); String checkSynthax(String value, String delimiter); String checkSnpStatus(Boolean genomeWide, Boolean limitedList);  }