Search in sources :

Example 21 with Gene

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;
}
Also used : RiskAllele(uk.ac.ebi.spot.goci.model.RiskAllele) ArrayList(java.util.ArrayList) Association(uk.ac.ebi.spot.goci.model.Association) Gene(uk.ac.ebi.spot.goci.model.Gene) SingleNucleotidePolymorphism(uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism) Locus(uk.ac.ebi.spot.goci.model.Locus) SnpFormColumn(uk.ac.ebi.spot.goci.curation.model.SnpFormColumn)

Aggregations

Gene (uk.ac.ebi.spot.goci.model.Gene)21 ArrayList (java.util.ArrayList)16 RiskAllele (uk.ac.ebi.spot.goci.model.RiskAllele)11 SingleNucleotidePolymorphism (uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism)9 Locus (uk.ac.ebi.spot.goci.model.Locus)8 Association (uk.ac.ebi.spot.goci.model.Association)6 EnsemblGene (uk.ac.ebi.spot.goci.model.EnsemblGene)6 EntrezGene (uk.ac.ebi.spot.goci.model.EntrezGene)6 GenomicContext (uk.ac.ebi.spot.goci.model.GenomicContext)5 Location (uk.ac.ebi.spot.goci.model.Location)4 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 SnpFormColumn (uk.ac.ebi.spot.goci.curation.model.SnpFormColumn)2 SnpFormRow (uk.ac.ebi.spot.goci.curation.model.SnpFormRow)2 SnpMappingForm (uk.ac.ebi.spot.goci.curation.model.SnpMappingForm)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1