def test_variant_printer():
    vcf_file = setup_vcf_file()
    variant_queue = Manager().Queue()
    head = HeaderParser()
    
    outfile = NamedTemporaryFile(mode='w+t', delete=False, suffix='.vcf')
    outfile.close()
    
    
    variant_printer = VariantPrinter(
        task_queue=variant_queue, 
        head=head, 
        mode='chromosome', 
        outfile = outfile.name
    )
    
    variant_printer.start()
    
    batch = OrderedDict()
    
    for line in open(vcf_file):
        line = line.rstrip()

        if line.startswith('#'):
            if line.startswith('##'):
                head.parse_meta_data(line)
            else:
                head.parse_header_line(line)
        else:
            variant_dict = get_variant_dict(line, head.header)
            print(variant_dict)
            variant_id = get_variant_id(variant_dict)
            variant_dict['variant_id'] = variant_id
            variant_dict['info_dict'] = get_info_dict(variant_dict['INFO'])
    
            variant_queue.put(variant_dict)
            
    
    variant_queue.put(None)
    
    variant_printer.join()
    
    variants = []
    with open(outfile.name, 'r') as f:
        for line in f:
            variants.append(line.rstrip().split('\t'))
    
    assert variants[0][0] == '1'
    assert variants[0][2] == '11900'
Test the variant printer
dataset/ETHPy150Open moonso/genmod/tests/utils/test_variant_printer.py/test_variant_printer