use of uk.ac.ebi.spot.goci.model.Gene in project goci by EBISPOT.
the class SnpInteractionAssociationService method createAssociation.
public Association createAssociation(SnpAssociationInteractionForm form) {
// Set simple string, boolean and float association attributes
Association association = setCommonAssociationElements(form);
// Set multi-snp and snp interaction checkboxes
association.setMultiSnpHaplotype(false);
association.setSnpInteraction(true);
// For each column create a loci
Collection<Locus> loci = new ArrayList<>();
for (SnpFormColumn col : form.getSnpFormColumns()) {
Locus locus = new Locus();
locus.setDescription("SNP x SNP interaction");
// Set locus genes
Collection<String> authorReportedGenes = col.getAuthorReportedGenes();
Collection<Gene> locusGenes = lociAttributesService.createGene(authorReportedGenes);
locus.setAuthorReportedGenes(locusGenes);
// Create SNP
String curatorEnteredSNP = col.getSnp();
SingleNucleotidePolymorphism snp = lociAttributesService.createSnp(curatorEnteredSNP);
// One risk allele per locus
String curatorEnteredRiskAllele = col.getStrongestRiskAllele();
RiskAllele riskAllele = lociAttributesService.createRiskAllele(curatorEnteredRiskAllele, snp);
Collection<RiskAllele> locusRiskAlleles = new ArrayList<>();
// Set risk allele attributes
riskAllele.setGenomeWide(col.getGenomeWide());
riskAllele.setLimitedList(col.getLimitedList());
riskAllele.setRiskFrequency(col.getRiskFrequency());
// Check for a proxy and if we have one create a proxy snp
Collection<String> curatorEnteredProxySnps = col.getProxySnps();
if (curatorEnteredProxySnps != null && !curatorEnteredProxySnps.isEmpty()) {
Collection<SingleNucleotidePolymorphism> riskAlleleProxySnps = new ArrayList<>();
for (String curatorEnteredProxySnp : curatorEnteredProxySnps) {
SingleNucleotidePolymorphism proxySnp = lociAttributesService.createSnp(curatorEnteredProxySnp);
riskAlleleProxySnps.add(proxySnp);
}
riskAllele.setProxySnps(riskAlleleProxySnps);
}
// Link risk allele to locus
locusRiskAlleles.add(riskAllele);
locus.setStrongestRiskAlleles(locusRiskAlleles);
// Add locus to collection and link to our association
loci.add(locus);
}
association.setLoci(loci);
return association;
}
Aggregations