def get_chr_template(stream, chrs):
 num_chrs = reduce((lambda x, y: (x + y[0])), chrs, 0)
 stream.write('//Number of independent (unlinked) chromosomes, and "chromosome structure" flag:  0 for identical structure across chromosomes, and  1 for different structures on different chromosomes.\n')
 if ((len(chrs) > 1) or (num_chrs == 1)):
  stream.write((str(num_chrs) + ' 1\n'))
 else:
  stream.write((str(num_chrs) + ' 0\n'))
 for chr in chrs:
  repeats = chr[0]
  loci = chr[1]
  if (len(chrs) == 1):
   _gen_loci(stream, loci)
  else:
   for i in range(repeats):
    _gen_loci(stream, loci)

def get_chr_template ( stream , chrs ) : num_chrs = reduce ( ( lambda x , y : ( x + y [ 0 ] ) ) , chrs , 0 ) stream . write ( '//Number of independent (unlinked) chromosomes, and "chromosome structure" flag:  0 for identical structure across chromosomes, and  1 for different structures on different chromosomes.\n' ) if ( ( len ( chrs ) > 1 ) or ( num_chrs == 1 ) ) : stream . write ( ( str ( num_chrs ) + ' 1\n' ) ) else : stream . write ( ( str ( num_chrs ) + ' 0\n' ) ) for chr in chrs : repeats = chr [ 0 ] loci = chr [ 1 ] if ( len ( chrs ) == 1 ) : _gen_loci ( stream , loci ) else : for i in range ( repeats ) : _gen_loci ( stream , loci )
writes a simcoal2 loci template part .