@Test public void testCreateInteractionForm() throws Exception { assertThat(snpAssociationFormService.createForm(OR_INTERACTION_ASSOCIATION)).isInstanceOf( SnpAssociationInteractionForm.class); SnpAssociationInteractionForm form = (SnpAssociationInteractionForm) snpAssociationFormService.createForm(OR_INTERACTION_ASSOCIATION); 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()); assertThat(form.getEfoTraits()).extracting("id", "trait", "uri") .contains(tuple(1001L, "atrophic rhinitis", "http: tuple(1002L, "HeLa", "http: assertNull(form.getBetaNum()); assertNull(form.getBetaUnit()); assertNull(form.getBetaDirection()); assertThat(form.getNumOfInteractions()).as("Check form NUMBER OF INTERACTIONS") .isEqualTo(2); 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)); }
@Override public SnpAssociationForm createForm(Association association) { SnpAssociationInteractionForm form = new SnpAssociationInteractionForm(); form.setAssociationId(association.getId()); form.setAssociationExtension(association.getAssociationExtension()); form.setPvalueDescription(association.getPvalueDescription()); form.setSnpType(association.getSnpType()); form.setSnpApproved(association.getSnpApproved()); form.setPvalueMantissa(association.getPvalueMantissa()); form.setPvalueExponent(association.getPvalueExponent()); form.setStandardError(association.getStandardError()); form.setRange(association.getRange()); form.setDescription(association.getDescription()); form.setRiskFrequency(association.getRiskFrequency()); form.setOrPerCopyNum(association.getOrPerCopyNum()); form.setOrPerCopyRecip(association.getOrPerCopyRecip()); form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange()); form.setBetaNum(association.getBetaNum()); form.setBetaUnit(association.getBetaUnit()); form.setBetaDirection(association.getBetaDirection()); form.setEfoTraits(association.getEfoTraits()); List<SnpFormColumn> snpFormColumns = new ArrayList<>(); Collection<Locus> loci = association.getLoci(); Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>(); Collection<SingleNucleotidePolymorphism> snps = new ArrayList<SingleNucleotidePolymorphism>(); List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>(); if (loci != null && !loci.isEmpty()) { for (Locus locus : loci) { SnpFormColumn snpFormColumn = new SnpFormColumn(); Collection<String> authorReportedGenes = new ArrayList<>(); for (Gene gene : locus.getAuthorReportedGenes()) { authorReportedGenes.add(gene.getGeneName()); } snpFormColumn.setAuthorReportedGenes(authorReportedGenes); Collection<RiskAllele> locusRiskAlleles = locus.getStrongestRiskAlleles(); String strongestRiskAllele = null; String snp = null; Collection<String> proxySnps = new ArrayList<>(); Boolean genomeWide = false; Boolean limitedList = false; String riskFrequency = null; if (locusRiskAlleles != null && locusRiskAlleles.size() == 1) { for (RiskAllele riskAllele : locusRiskAlleles) { strongestRiskAllele = riskAllele.getRiskAlleleName(); snp = riskAllele.getSnp().getRsId(); SingleNucleotidePolymorphism snp_obj = riskAllele.getSnp(); snps.add(snp_obj); Collection<Location> locations = snp_obj.getLocations(); for (Location location : locations) { SnpMappingForm snpMappingForm = new SnpMappingForm(snp, location); snpMappingForms.add(snpMappingForm); } snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp_obj.getId())); if (riskAllele.getProxySnps() != null) { for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) { proxySnps.add(riskAlleleProxySnp.getRsId()); } } if (riskAllele.getGenomeWide() != null && riskAllele.getGenomeWide()) { genomeWide = true; } if (riskAllele.getLimitedList() != null && riskAllele.getLimitedList()) { limitedList = true; } riskFrequency = riskAllele.getRiskFrequency(); } } else { throw new RuntimeException( "More than one risk allele found for locus " + locus.getId() + ", this is not supported yet for SNP interaction associations" ); } snpFormColumn.setStrongestRiskAllele(strongestRiskAllele); snpFormColumn.setSnp(snp); snpFormColumn.setProxySnps(proxySnps); snpFormColumn.setGenomeWide(genomeWide); snpFormColumn.setLimitedList(limitedList); snpFormColumn.setRiskFrequency(riskFrequency); snpFormColumns.add(snpFormColumn); } } form.setSnpMappingForms(snpMappingForms); form.setGenomicContexts(snpGenomicContexts); form.setSnps(snps); form.setSnpFormColumns(snpFormColumns); form.setNumOfInteractions(snpFormColumns.size()); return form; }
SnpInteractionAssociationService implements SnpAssociationFormService { @Override public SnpAssociationForm createForm(Association association) { SnpAssociationInteractionForm form = new SnpAssociationInteractionForm(); form.setAssociationId(association.getId()); form.setAssociationExtension(association.getAssociationExtension()); form.setPvalueDescription(association.getPvalueDescription()); form.setSnpType(association.getSnpType()); form.setSnpApproved(association.getSnpApproved()); form.setPvalueMantissa(association.getPvalueMantissa()); form.setPvalueExponent(association.getPvalueExponent()); form.setStandardError(association.getStandardError()); form.setRange(association.getRange()); form.setDescription(association.getDescription()); form.setRiskFrequency(association.getRiskFrequency()); form.setOrPerCopyNum(association.getOrPerCopyNum()); form.setOrPerCopyRecip(association.getOrPerCopyRecip()); form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange()); form.setBetaNum(association.getBetaNum()); form.setBetaUnit(association.getBetaUnit()); form.setBetaDirection(association.getBetaDirection()); form.setEfoTraits(association.getEfoTraits()); List<SnpFormColumn> snpFormColumns = new ArrayList<>(); Collection<Locus> loci = association.getLoci(); Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>(); Collection<SingleNucleotidePolymorphism> snps = new ArrayList<SingleNucleotidePolymorphism>(); List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>(); if (loci != null && !loci.isEmpty()) { for (Locus locus : loci) { SnpFormColumn snpFormColumn = new SnpFormColumn(); Collection<String> authorReportedGenes = new ArrayList<>(); for (Gene gene : locus.getAuthorReportedGenes()) { authorReportedGenes.add(gene.getGeneName()); } snpFormColumn.setAuthorReportedGenes(authorReportedGenes); Collection<RiskAllele> locusRiskAlleles = locus.getStrongestRiskAlleles(); String strongestRiskAllele = null; String snp = null; Collection<String> proxySnps = new ArrayList<>(); Boolean genomeWide = false; Boolean limitedList = false; String riskFrequency = null; if (locusRiskAlleles != null && locusRiskAlleles.size() == 1) { for (RiskAllele riskAllele : locusRiskAlleles) { strongestRiskAllele = riskAllele.getRiskAlleleName(); snp = riskAllele.getSnp().getRsId(); SingleNucleotidePolymorphism snp_obj = riskAllele.getSnp(); snps.add(snp_obj); Collection<Location> locations = snp_obj.getLocations(); for (Location location : locations) { SnpMappingForm snpMappingForm = new SnpMappingForm(snp, location); snpMappingForms.add(snpMappingForm); } snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp_obj.getId())); if (riskAllele.getProxySnps() != null) { for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) { proxySnps.add(riskAlleleProxySnp.getRsId()); } } if (riskAllele.getGenomeWide() != null && riskAllele.getGenomeWide()) { genomeWide = true; } if (riskAllele.getLimitedList() != null && riskAllele.getLimitedList()) { limitedList = true; } riskFrequency = riskAllele.getRiskFrequency(); } } else { throw new RuntimeException( "More than one risk allele found for locus " + locus.getId() + ", this is not supported yet for SNP interaction associations" ); } snpFormColumn.setStrongestRiskAllele(strongestRiskAllele); snpFormColumn.setSnp(snp); snpFormColumn.setProxySnps(proxySnps); snpFormColumn.setGenomeWide(genomeWide); snpFormColumn.setLimitedList(limitedList); snpFormColumn.setRiskFrequency(riskFrequency); snpFormColumns.add(snpFormColumn); } } form.setSnpMappingForms(snpMappingForms); form.setGenomicContexts(snpGenomicContexts); form.setSnps(snps); form.setSnpFormColumns(snpFormColumns); form.setNumOfInteractions(snpFormColumns.size()); return form; } }
SnpInteractionAssociationService implements SnpAssociationFormService { @Override public SnpAssociationForm createForm(Association association) { SnpAssociationInteractionForm form = new SnpAssociationInteractionForm(); form.setAssociationId(association.getId()); form.setAssociationExtension(association.getAssociationExtension()); form.setPvalueDescription(association.getPvalueDescription()); form.setSnpType(association.getSnpType()); form.setSnpApproved(association.getSnpApproved()); form.setPvalueMantissa(association.getPvalueMantissa()); form.setPvalueExponent(association.getPvalueExponent()); form.setStandardError(association.getStandardError()); form.setRange(association.getRange()); form.setDescription(association.getDescription()); form.setRiskFrequency(association.getRiskFrequency()); form.setOrPerCopyNum(association.getOrPerCopyNum()); form.setOrPerCopyRecip(association.getOrPerCopyRecip()); form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange()); form.setBetaNum(association.getBetaNum()); form.setBetaUnit(association.getBetaUnit()); form.setBetaDirection(association.getBetaDirection()); form.setEfoTraits(association.getEfoTraits()); List<SnpFormColumn> snpFormColumns = new ArrayList<>(); Collection<Locus> loci = association.getLoci(); Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>(); Collection<SingleNucleotidePolymorphism> snps = new ArrayList<SingleNucleotidePolymorphism>(); List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>(); if (loci != null && !loci.isEmpty()) { for (Locus locus : loci) { SnpFormColumn snpFormColumn = new SnpFormColumn(); Collection<String> authorReportedGenes = new ArrayList<>(); for (Gene gene : locus.getAuthorReportedGenes()) { authorReportedGenes.add(gene.getGeneName()); } snpFormColumn.setAuthorReportedGenes(authorReportedGenes); Collection<RiskAllele> locusRiskAlleles = locus.getStrongestRiskAlleles(); String strongestRiskAllele = null; String snp = null; Collection<String> proxySnps = new ArrayList<>(); Boolean genomeWide = false; Boolean limitedList = false; String riskFrequency = null; if (locusRiskAlleles != null && locusRiskAlleles.size() == 1) { for (RiskAllele riskAllele : locusRiskAlleles) { strongestRiskAllele = riskAllele.getRiskAlleleName(); snp = riskAllele.getSnp().getRsId(); SingleNucleotidePolymorphism snp_obj = riskAllele.getSnp(); snps.add(snp_obj); Collection<Location> locations = snp_obj.getLocations(); for (Location location : locations) { SnpMappingForm snpMappingForm = new SnpMappingForm(snp, location); snpMappingForms.add(snpMappingForm); } snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp_obj.getId())); if (riskAllele.getProxySnps() != null) { for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) { proxySnps.add(riskAlleleProxySnp.getRsId()); } } if (riskAllele.getGenomeWide() != null && riskAllele.getGenomeWide()) { genomeWide = true; } if (riskAllele.getLimitedList() != null && riskAllele.getLimitedList()) { limitedList = true; } riskFrequency = riskAllele.getRiskFrequency(); } } else { throw new RuntimeException( "More than one risk allele found for locus " + locus.getId() + ", this is not supported yet for SNP interaction associations" ); } snpFormColumn.setStrongestRiskAllele(strongestRiskAllele); snpFormColumn.setSnp(snp); snpFormColumn.setProxySnps(proxySnps); snpFormColumn.setGenomeWide(genomeWide); snpFormColumn.setLimitedList(limitedList); snpFormColumn.setRiskFrequency(riskFrequency); snpFormColumns.add(snpFormColumn); } } form.setSnpMappingForms(snpMappingForms); form.setGenomicContexts(snpGenomicContexts); form.setSnps(snps); form.setSnpFormColumns(snpFormColumns); form.setNumOfInteractions(snpFormColumns.size()); return form; } @Autowired  SnpInteractionAssociationService(GenomicContextRepository genomicContextRepository,
                                            LociAttributesService lociAttributesService); }
SnpInteractionAssociationService implements SnpAssociationFormService { @Override public SnpAssociationForm createForm(Association association) { SnpAssociationInteractionForm form = new SnpAssociationInteractionForm(); form.setAssociationId(association.getId()); form.setAssociationExtension(association.getAssociationExtension()); form.setPvalueDescription(association.getPvalueDescription()); form.setSnpType(association.getSnpType()); form.setSnpApproved(association.getSnpApproved()); form.setPvalueMantissa(association.getPvalueMantissa()); form.setPvalueExponent(association.getPvalueExponent()); form.setStandardError(association.getStandardError()); form.setRange(association.getRange()); form.setDescription(association.getDescription()); form.setRiskFrequency(association.getRiskFrequency()); form.setOrPerCopyNum(association.getOrPerCopyNum()); form.setOrPerCopyRecip(association.getOrPerCopyRecip()); form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange()); form.setBetaNum(association.getBetaNum()); form.setBetaUnit(association.getBetaUnit()); form.setBetaDirection(association.getBetaDirection()); form.setEfoTraits(association.getEfoTraits()); List<SnpFormColumn> snpFormColumns = new ArrayList<>(); Collection<Locus> loci = association.getLoci(); Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>(); Collection<SingleNucleotidePolymorphism> snps = new ArrayList<SingleNucleotidePolymorphism>(); List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>(); if (loci != null && !loci.isEmpty()) { for (Locus locus : loci) { SnpFormColumn snpFormColumn = new SnpFormColumn(); Collection<String> authorReportedGenes = new ArrayList<>(); for (Gene gene : locus.getAuthorReportedGenes()) { authorReportedGenes.add(gene.getGeneName()); } snpFormColumn.setAuthorReportedGenes(authorReportedGenes); Collection<RiskAllele> locusRiskAlleles = locus.getStrongestRiskAlleles(); String strongestRiskAllele = null; String snp = null; Collection<String> proxySnps = new ArrayList<>(); Boolean genomeWide = false; Boolean limitedList = false; String riskFrequency = null; if (locusRiskAlleles != null && locusRiskAlleles.size() == 1) { for (RiskAllele riskAllele : locusRiskAlleles) { strongestRiskAllele = riskAllele.getRiskAlleleName(); snp = riskAllele.getSnp().getRsId(); SingleNucleotidePolymorphism snp_obj = riskAllele.getSnp(); snps.add(snp_obj); Collection<Location> locations = snp_obj.getLocations(); for (Location location : locations) { SnpMappingForm snpMappingForm = new SnpMappingForm(snp, location); snpMappingForms.add(snpMappingForm); } snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp_obj.getId())); if (riskAllele.getProxySnps() != null) { for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) { proxySnps.add(riskAlleleProxySnp.getRsId()); } } if (riskAllele.getGenomeWide() != null && riskAllele.getGenomeWide()) { genomeWide = true; } if (riskAllele.getLimitedList() != null && riskAllele.getLimitedList()) { limitedList = true; } riskFrequency = riskAllele.getRiskFrequency(); } } else { throw new RuntimeException( "More than one risk allele found for locus " + locus.getId() + ", this is not supported yet for SNP interaction associations" ); } snpFormColumn.setStrongestRiskAllele(strongestRiskAllele); snpFormColumn.setSnp(snp); snpFormColumn.setProxySnps(proxySnps); snpFormColumn.setGenomeWide(genomeWide); snpFormColumn.setLimitedList(limitedList); snpFormColumn.setRiskFrequency(riskFrequency); snpFormColumns.add(snpFormColumn); } } form.setSnpMappingForms(snpMappingForms); form.setGenomicContexts(snpGenomicContexts); form.setSnps(snps); form.setSnpFormColumns(snpFormColumns); form.setNumOfInteractions(snpFormColumns.size()); return form; } @Autowired  SnpInteractionAssociationService(GenomicContextRepository genomicContextRepository,
                                            LociAttributesService lociAttributesService); @Override SnpAssociationForm createForm(Association association); Association createAssociation(SnpAssociationInteractionForm form); }
SnpInteractionAssociationService implements SnpAssociationFormService { @Override public SnpAssociationForm createForm(Association association) { SnpAssociationInteractionForm form = new SnpAssociationInteractionForm(); form.setAssociationId(association.getId()); form.setAssociationExtension(association.getAssociationExtension()); form.setPvalueDescription(association.getPvalueDescription()); form.setSnpType(association.getSnpType()); form.setSnpApproved(association.getSnpApproved()); form.setPvalueMantissa(association.getPvalueMantissa()); form.setPvalueExponent(association.getPvalueExponent()); form.setStandardError(association.getStandardError()); form.setRange(association.getRange()); form.setDescription(association.getDescription()); form.setRiskFrequency(association.getRiskFrequency()); form.setOrPerCopyNum(association.getOrPerCopyNum()); form.setOrPerCopyRecip(association.getOrPerCopyRecip()); form.setOrPerCopyRecipRange(association.getOrPerCopyRecipRange()); form.setBetaNum(association.getBetaNum()); form.setBetaUnit(association.getBetaUnit()); form.setBetaDirection(association.getBetaDirection()); form.setEfoTraits(association.getEfoTraits()); List<SnpFormColumn> snpFormColumns = new ArrayList<>(); Collection<Locus> loci = association.getLoci(); Collection<GenomicContext> snpGenomicContexts = new ArrayList<GenomicContext>(); Collection<SingleNucleotidePolymorphism> snps = new ArrayList<SingleNucleotidePolymorphism>(); List<SnpMappingForm> snpMappingForms = new ArrayList<SnpMappingForm>(); if (loci != null && !loci.isEmpty()) { for (Locus locus : loci) { SnpFormColumn snpFormColumn = new SnpFormColumn(); Collection<String> authorReportedGenes = new ArrayList<>(); for (Gene gene : locus.getAuthorReportedGenes()) { authorReportedGenes.add(gene.getGeneName()); } snpFormColumn.setAuthorReportedGenes(authorReportedGenes); Collection<RiskAllele> locusRiskAlleles = locus.getStrongestRiskAlleles(); String strongestRiskAllele = null; String snp = null; Collection<String> proxySnps = new ArrayList<>(); Boolean genomeWide = false; Boolean limitedList = false; String riskFrequency = null; if (locusRiskAlleles != null && locusRiskAlleles.size() == 1) { for (RiskAllele riskAllele : locusRiskAlleles) { strongestRiskAllele = riskAllele.getRiskAlleleName(); snp = riskAllele.getSnp().getRsId(); SingleNucleotidePolymorphism snp_obj = riskAllele.getSnp(); snps.add(snp_obj); Collection<Location> locations = snp_obj.getLocations(); for (Location location : locations) { SnpMappingForm snpMappingForm = new SnpMappingForm(snp, location); snpMappingForms.add(snpMappingForm); } snpGenomicContexts.addAll(genomicContextRepository.findBySnpId(snp_obj.getId())); if (riskAllele.getProxySnps() != null) { for (SingleNucleotidePolymorphism riskAlleleProxySnp : riskAllele.getProxySnps()) { proxySnps.add(riskAlleleProxySnp.getRsId()); } } if (riskAllele.getGenomeWide() != null && riskAllele.getGenomeWide()) { genomeWide = true; } if (riskAllele.getLimitedList() != null && riskAllele.getLimitedList()) { limitedList = true; } riskFrequency = riskAllele.getRiskFrequency(); } } else { throw new RuntimeException( "More than one risk allele found for locus " + locus.getId() + ", this is not supported yet for SNP interaction associations" ); } snpFormColumn.setStrongestRiskAllele(strongestRiskAllele); snpFormColumn.setSnp(snp); snpFormColumn.setProxySnps(proxySnps); snpFormColumn.setGenomeWide(genomeWide); snpFormColumn.setLimitedList(limitedList); snpFormColumn.setRiskFrequency(riskFrequency); snpFormColumns.add(snpFormColumn); } } form.setSnpMappingForms(snpMappingForms); form.setGenomicContexts(snpGenomicContexts); form.setSnps(snps); form.setSnpFormColumns(snpFormColumns); form.setNumOfInteractions(snpFormColumns.size()); return form; } @Autowired  SnpInteractionAssociationService(GenomicContextRepository genomicContextRepository,
                                            LociAttributesService lociAttributesService); @Override SnpAssociationForm createForm(Association association); Association createAssociation(SnpAssociationInteractionForm form);  }