Search in sources :

Example 1 with VcfToEntity

use of org.molgenis.data.vcf.format.VcfToEntity in project molgenis by molgenis.

the class VcfRepository method iterator.

/**
 * Returns an iterator for this repository.
 * <p>
 * Use with caution! Multiple iterators will all point to the same line in the VCF file, leading to unpredictable
 * behaviour. If you want to get the EntityType of this repository and you can't access getEntityType(),
 * convert the iterator to a PeekingIterator and peek the first Entity.
 */
@Override
public Iterator<Entity> iterator() {
    Iterator<VcfRecord> vcfRecordIterator = Iterators.unmodifiableIterator(vcfReaderFactory.get().iterator());
    VcfToEntity vcfToEntity = vcfToEntitySupplier.get();
    return Iterators.transform(vcfRecordIterator, vcfToEntity::toEntity);
}
Also used : VcfRecord(org.molgenis.vcf.VcfRecord) VcfToEntity(org.molgenis.data.vcf.format.VcfToEntity)

Aggregations

VcfToEntity (org.molgenis.data.vcf.format.VcfToEntity)1 VcfRecord (org.molgenis.vcf.VcfRecord)1