INNER CODE UNIT · Python
ncols
BirolLab/straglr · straglr_compare.py:25
ncols = 5 + 2 * max_num_alleles
for locus in loci:
cols = list(locus)
for allele in sorted(loci[locus]):
cols.extend([str(allele), loci[locus][allele]])
if len(cols) < ncols:
cols.extend(['-'] * (ncols - len(cols)))
bed_str += '{}\n'.format('\t'.join(cols))
return BedTool(bed_str, from_string=True).sort()
def create_simple_bed(loci):
bed_str = ''
for locus in loci:
bed_str += '{}\n'.format('\t'.join(list(map(str, locus[:3]))))
return BedTool(bed_str, from_string=True).sort()