def __init__(self, filename=None, key=None, sorted=True, juncs=False):
        super(Bed, self).__init__(filename)

        # the sorting key provides some flexibility in ordering the features
        # for example, user might not like the lexico-order of seqid
        self.nullkey = lambda x: (natsort_key(x.seqid), x.start, x.accn)
        self.key = key or self.nullkey

        if not filename:
            return

        for line in must_open(filename):
            if line[0] == "#" or (juncs and line.startswith('track name')):
                continue
            self.append(BedLine(line))

        if sorted:
            self.sort(key=self.key)
dataset/ETHPy150Open tanghaibao/jcvi/formats/bed.py/Bed.__init__/original