Search in sources :

Example 1 with SampleData

use of io.swagger.model.SampleData in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class GenotypesApiController method submitGenotypes.

@Override
public ResponseEntity<Samples> submitGenotypes(@ApiParam(value = "Genotypes", required = true) @Valid @RequestBody Genotypes genotypes) {
    List<Genotype> genotypeList = genotypes.getGenotype();
    Samples samples = new Samples();
    SampleData sampleData = null;
    for (Genotype genotype : genotypeList) {
        LinkageDisequilibriumGenotypeList linkedGLString = GLStringUtilities.inflateGenotypeList(genotype.getId(), genotype.getGlString(), null);
        Sample sample = LinkageDisequilibriumAnalyzer.detectLinkages(linkedGLString);
        sampleData = populateSwaggerObject(sample);
        samples.addSampleItem(sampleData);
    }
    return ResponseEntity.ok(samples);
}
Also used : LinkageDisequilibriumGenotypeList(org.dash.valid.gl.LinkageDisequilibriumGenotypeList) Samples(io.swagger.model.Samples) SampleData(io.swagger.model.SampleData) Sample(org.dash.valid.Sample) Genotype(io.swagger.model.Genotype)

Example 2 with SampleData

use of io.swagger.model.SampleData in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class GenotypesApiController method populateSwaggerObject.

public SampleData populateSwaggerObject(Sample sample) {
    SampleData sampleData;
    sampleData = new SampleData();
    sampleData.setId(sample.getId());
    sampleData.setGlString(sample.getGlString());
    sampleData.setProcessedGlString(sample.getProcessedGlString());
    for (HaplotypePair pair : sample.getFindings().getLinkedPairs()) {
        HaplotypePairData pairData = new HaplotypePairData();
        pairData.setHaplotype1(pair.getHaplotypes().get(0).getHaplotypeString());
        pairData.setHaplotype2(pair.getHaplotypes().get(1).getHaplotypeString());
        for (RelativeFrequencyByRace freqByRace : pair.getFrequencies()) {
            FindingData finding = new FindingData();
            finding.setRace(freqByRace.getRace());
            finding.setFrequency(new BigDecimal(freqByRace.getFrequency()));
            finding.setRelativeFrequency(new BigDecimal(freqByRace.getRelativeFrequency()));
            finding.setHaplotype1Frequency(new BigDecimal(freqByRace.getHap1Frequency()));
            finding.setHaplotype2Frequency(new BigDecimal(freqByRace.getHap2Frequency()));
            pairData.addFindingItem(finding);
        }
        sampleData.addHaplotypePairItem(pairData);
    }
    return sampleData;
}
Also used : HaplotypePair(org.dash.valid.gl.haplo.HaplotypePair) RelativeFrequencyByRace(org.dash.valid.race.RelativeFrequencyByRace) SampleData(io.swagger.model.SampleData) FindingData(io.swagger.model.FindingData) HaplotypePairData(io.swagger.model.HaplotypePairData) BigDecimal(java.math.BigDecimal)

Aggregations

SampleData (io.swagger.model.SampleData)2 FindingData (io.swagger.model.FindingData)1 Genotype (io.swagger.model.Genotype)1 HaplotypePairData (io.swagger.model.HaplotypePairData)1 Samples (io.swagger.model.Samples)1 BigDecimal (java.math.BigDecimal)1 Sample (org.dash.valid.Sample)1 LinkageDisequilibriumGenotypeList (org.dash.valid.gl.LinkageDisequilibriumGenotypeList)1 HaplotypePair (org.dash.valid.gl.haplo.HaplotypePair)1 RelativeFrequencyByRace (org.dash.valid.race.RelativeFrequencyByRace)1