code: def beds_to_boolean(beds, ref=None, beds_sorted=False, ref_sorted=False,
                      **kwargs):
      beds = copy.deepcopy(beds)
      fns = []
      for i,v in enumerate(beds):
          if type(v) == str:
              fns.append(v)
              beds[i] = pbt.BedTool(v)
          else:
              fns.append(v.fn)
          if not beds_sorted:
              beds[i] = beds[i].sort()
      names = _sample_names(fns, kwargs)
      if ref:
          if type(ref) == str:
              ref = pbt.BedTool(ref)
          if not ref_sorted:
              ref = ref.sort()
      else:
          ref = combine(beds)
      ind = []
      for r in ref:
          ind.append('{}:{}-{}'.format(r.chrom, r.start, r.stop))
      bdf = pd.DataFrame(0, index=ind, columns=names)
      for i,bed in enumerate(beds):
          res = ref.intersect(bed, sorted=True, wa=True)
          ind = []
          for r in res:
              ind.append('{}:{}-{}'.format(r.chrom,
                                           r.start,
                                           r.stop))
          bdf.ix[ind, names[i]] = 1
      return bdf