def add_contig_to_header(line, ref_file):
    """Streaming target to add contigs to a VCF file header.
    """
    if line.startswith("##fileformat=VCF"):
        out = [line]
        for region in ref.file_contigs(ref_file):
            out.append("##contig=<ID=%s,length=%s>" % (region.name, region.size))
        return "\n".join(out)
    else:
        return line
def add_contig_to_header ( line , ref_file ) : if line . startswith ( "##fileformat=VCF" ) : out = [ line ] for region in ref . file_contigs ( ref_file ) : out . append ( "##contig=<ID=%s,length=%s>" % ( region . name , region . size ) ) return "\n" . join ( out ) else : return line
Streaming target to add contigs to a VCF file header.