vcf_writer.py
def create_vcf_file(path, sample):
    """ Creates VCF header and Variant File. 
    Writes VCF header in Variant File and returns it. 
        
    Parameters
    ----------
    path: str
        Name and path of an output vcf file, for example output/out.vcf
    sample: str
        Name of a sample to add to the VCF file
    
    Returns
    -------
    pysam.VariantFile
        Created VCF file with header written in it
    """
    
    vcf_header = pysam.VariantHeader()
    vcf_header.add_sample(sample)
    
    current_time = datetime.datetime.now()
    date = current_time.strftime('%Y%m%d')
    vcf_header.add_line('##fileDate=' + date)
    vcf_header.add_line('##source=Ema&Nikola')                    
    
    faifile = open("test_data/human_g1k_v37_decoy.fasta.fai")
    for line in faifile:
            split_line = line.split("\t")
            contig = '##contig=<ID=' + str(split_line[0]) + ', length=' + str(split_line[1]) + '>'
            vcf_header.add_line(contig)
    faifile.close()
    vcf_header.add_line("##ALT=<ID=*,Description=Different allele than referent.>")
    vcf_header.add_line("##FORMAT=<ID=GT,Number=1,Type=String,Description=Genotype>")
    vcf_header.add_line("##FORMAT=<ID=VAF,Number=1,Type=String,Description=Variant allele frequency>")
 
    vcf = pysam.VariantFile(path, 'w', header = vcf_header)
    return vcf
 Creates VCF header and Variant File. 
    Writes VCF header in Variant File and returns it. 
        
    Parameters
    ----------
    path: str
        Name and path of an output vcf file, for example output/out.vcf
    sample: str
        Name of a sample to add to the VCF file
    
    Returns
    -------
    pysam.VariantFile
        Created VCF file with header written in it
    
Creates VCF header and Variant File.
Writes VCF header in Variant File and returns it.

Parameters

str
Name and path of an output vcf file, for example output/out.vcf
sample: str
Name of a sample to add to the VCF file

Returns

pysam.VariantFile
Created VCF file with header written in it
Creates VCF header and Variant File . Writes VCF header in Variant File and returns it . Parameters str Name and path of an output vcf file for example output / out . vcf sample : str Name of a sample to add to the VCF file Returns pysam . VariantFile Created VCF file with header written in it
def create_vcf_file(path, sample):
    vcf_header = pysam.VariantHeader()
    vcf_header.add_sample(sample)
    current_time = datetime.datetime.now()
    date = current_time.strftime('%Y%m%d')
    vcf_header.add_line('##fileDate=' + date)
    vcf_header.add_line('##source=Ema&Nikola')                    
    faifile = open("test_data/human_g1k_v37_decoy.fasta.fai")
    for line in faifile:
            split_line = line.split("\t")
            contig = '##contig=<ID=' + str(split_line[0]) + ', length=' + str(split_line[1]) + '>'
            vcf_header.add_line(contig)
    faifile.close()
    vcf_header.add_line("##ALT=<ID=*,Description=Different allele than referent.>")
    vcf_header.add_line("##FORMAT=<ID=GT,Number=1,Type=String,Description=Genotype>")
    vcf_header.add_line("##FORMAT=<ID=VAF,Number=1,Type=String,Description=Variant allele frequency>")
    vcf = pysam.VariantFile(path, 'w', header = vcf_header)
    return vcf
def create_vcf_file ( path , sample ) : vcf_header = pysam . VariantHeader ( ) vcf_header . add_sample ( sample ) current_time = datetime . datetime . now ( ) date = current_time . strftime ( '%Y%m%d' ) vcf_header . add_line ( '##fileDate=' + date ) vcf_header . add_line ( '##source=Ema&Nikola' ) faifile = open ( "test_data/human_g1k_v37_decoy.fasta.fai" ) for line in faifile : split_line = line . split ( "\t" ) contig = '##contig=<ID=' + str ( split_line [ 0 ] ) + ', length=' + str ( split_line [ 1 ] ) + '>' vcf_header . add_line ( contig ) faifile . close ( ) vcf_header . add_line ( "##ALT=<ID=*,Description=Different allele than referent.>" ) vcf_header . add_line ( "##FORMAT=<ID=GT,Number=1,Type=String,Description=Genotype>" ) vcf_header . add_line ( "##FORMAT=<ID=VAF,Number=1,Type=String,Description=Variant allele frequency>" ) vcf = pysam . VariantFile ( path , 'w' , header = vcf_header ) return vcf
Creates VCF header and Variant File.
Creates VCF header and Variant File .
""" Creates VCF header and Variant File. 
    Writes VCF header in Variant File and returns it. 
        
    Parameters
    ----------
    path: str
        Name and path of an output vcf file, for example output/out.vcf
    sample: str
        Name of a sample to add to the VCF file
    
    Returns
    -------
    pysam.VariantFile
        Created VCF file with header written in it
    """
path
sample