for row in sample_data:
for chrom, data in iteritems(row):
if data:
max_posn = max(coord[1] for coord in data)
chrom_sizes[chrom] = max(max_posn, chrom_sizes.get(chrom, 0))
else:
chrom_sizes[chrom] = chrom_sizes.get(chrom, 0)
chrom_sizes = collections.OrderedDict(sorted(iteritems(chrom_sizes),
After Change
for row in sample_data:
for chrom, data in iteritems(row):
if len(data):
max_posn = data.end.max() // max(coord[1] for coord in data)
chrom_sizes[chrom] = max(max_posn, chrom_sizes.get(chrom, 0))
else:
chrom_sizes[chrom] = chrom_sizes.get(chrom, 0)