parameters: (filelike, extrainfo="", chrprefix="chr")
docstring: write a VCF header
docstring_summary: write a VCF header
docstring_tokens: write a VCF header
function: def writeVCFHeader(filelike, extrainfo="", chrprefix="chr"):
      """ write a VCF header
      """
      header = ["CHROM",
                "POS",
                "ID",
                "REF",
                "ALT",
                "QUAL",
                "FILTER",
                "INFO",
                "FORMAT",
                "SIMPLE"]
  
      infos = ['##fileformat=VCFv4.1',
               '##reference=hg19',
               '##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">']
  
      if extrainfo:
          if type(extrainfo) is list:
              infos += extrainfo
          else:
              infos += extrainfo.split("\n")
  
      contigs = [["1", "249250621"], ["2", "243199373"], ["3", "198022430"], ["4", "191154276"],
                 ["5", "180915260"], ["6", "171115067"], ["7", "159138663"], ["8", "146364022"],
                 ["9", "141213431"], ["10", "135534747"], ["11", "135006516"],
                 ["12", "133851895"], ["13", "115169878"], ["14", "107349540"], ["15", "102531392"],
                 ["16", "90354753"], ["17", "81195210"], ["18", "78077248"], ["19", "59128983"],
                 ["20", "63025520"], ["21", "48129895"], ["22", "51304566"], ["X", "155270560"]]
  
      meta = ["##fileDate=" + date.today().isoformat(),
              "##source=HaploCompare",
              "##source_version=%s" % version]
  
      for i in infos:
          filelike.write(i + "\n")
      for c in contigs:
          filelike.write('##contig=<ID=' + chrprefix + c[0] + ',length=' + c[1] + '>\n')
      for i in meta:
          filelike.write(i + "\n")
  
      filelike.write("#" + "\t".join(header) + "\n")
function_tokens: def writeVCFHeader ( filelike , extrainfo = "" , chrprefix = "chr" ) : header = [ "CHROM" , "POS" , "ID" , "REF" , "ALT" , "QUAL" , "FILTER" , "INFO" , "FORMAT" , "SIMPLE" ] infos = [ '##fileformat=VCFv4.1' , '##reference=hg19' , '##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">' ] if extrainfo : if type ( extrainfo ) is list : infos += extrainfo else : infos += extrainfo . split ( "\n" ) contigs = [ [ "1" , "249250621" ] , [ "2" , "243199373" ] , [ "3" , "198022430" ] , [ "4" , "191154276" ] , [ "5" , "180915260" ] , [ "6" , "171115067" ] , [ "7" , "159138663" ] , [ "8" , "146364022" ] , [ "9" , "141213431" ] , [ "10" , "135534747" ] , [ "11" , "135006516" ] , [ "12" , "133851895" ] , [ "13" , "115169878" ] , [ "14" , "107349540" ] , [ "15" , "102531392" ] , [ "16" , "90354753" ] , [ "17" , "81195210" ] , [ "18" , "78077248" ] , [ "19" , "59128983" ] , [ "20" , "63025520" ] , [ "21" , "48129895" ] , [ "22" , "51304566" ] , [ "X" , "155270560" ] ] meta = [ "##fileDate=" + date . today ( ) . isoformat ( ) , "##source=HaploCompare" , "##source_version=%s" % version ] for i in infos : filelike . write ( i + "\n" ) for c in contigs : filelike . write ( '##contig=<ID=' + chrprefix + c [ 0 ] + ',length=' + c [ 1 ] + '>\n' ) for i in meta : filelike . write ( i + "\n" ) filelike . write ( "#" + "\t" . join ( header ) + "\n" )