Search in sources :

Example 1 with Allele

use of org.molgenis.genotype.Allele in project molgenis by molgenis.

the class VcfToEntity method toEntity.

public Entity toEntity(VcfRecord vcfRecord) {
    Entity entity = new DynamicEntity(entityType);
    entity.set(CHROM, vcfRecord.getChromosome());
    entity.set(ALT, StringUtils.join(Lists.transform(vcfRecord.getAlternateAlleles(), Allele::toString), ','));
    entity.set(POS, vcfRecord.getPosition());
    entity.set(REF, vcfRecord.getReferenceAllele().toString());
    entity.set(FILTER, vcfRecord.getFilterStatus());
    entity.set(QUAL, vcfRecord.getQuality());
    entity.set(ID, StringUtils.join(vcfRecord.getIdentifiers(), ','));
    String id = VcfUtils.createId(entity);
    entity.set(INTERNAL_ID, id);
    writeInfoFieldsToEntity(vcfRecord, entity);
    if (sampleEntityType != null) {
        List<Entity> samples = createSampleEntities(vcfRecord, entity.get(POS) + "_" + entity.get(ALT), id);
        entity.set(SAMPLES, samples);
    }
    return entity;
}
Also used : DynamicEntity(org.molgenis.data.support.DynamicEntity) Entity(org.molgenis.data.Entity) Allele(org.molgenis.genotype.Allele) DynamicEntity(org.molgenis.data.support.DynamicEntity)

Aggregations

Entity (org.molgenis.data.Entity)1 DynamicEntity (org.molgenis.data.support.DynamicEntity)1 Allele (org.molgenis.genotype.Allele)1