@Test void testToEntityMissingValues() throws IOException { String vcfHeaders = "##fileformat=VCFv4.1\n" + "##INFO=<ID=GoNL_AF,Number=.,Type=Float,Description=\"The allele frequency for variants seen in the population used for the GoNL project\">\n" + "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n"; VcfMeta vcfMeta = parseHeaders(vcfHeaders); VcfToEntity vcfToEntity = new VcfToEntity("entityTypeName", vcfMeta, vcfAttrs, entityTypeFactory, attrMetaFactory); VcfRecord record = new VcfRecord( vcfMeta, new String[] {"1", "54728", ".", "G", "T,C", ".", ".", "GoNL_AF=0.01,."}); Entity entity = vcfToEntity.toEntity(record); assertEquals("0.01,.", entity.getString("GoNL_AF")); }
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; }
VcfToEntity { 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; } }
VcfToEntity { 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; } VcfToEntity(
      String entityTypeId,
      VcfMeta vcfMeta,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); }
VcfToEntity { 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; } VcfToEntity(
      String entityTypeId,
      VcfMeta vcfMeta,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); Entity toEntity(VcfRecord vcfRecord); EntityType getEntityType(); }
VcfToEntity { 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; } VcfToEntity(
      String entityTypeId,
      VcfMeta vcfMeta,
      VcfAttributes vcfAttributes,
      EntityTypeFactory entityTypeFactory,
      AttributeFactory attrMetaFactory); Entity toEntity(VcfRecord vcfRecord); EntityType getEntityType();  }