def _resolve_features(self):
        """Resolve Parent/ID relationships and yield all top-level features."""

        for parentid in self.featsbyparent:
            parent = self.featsbyid[parentid]
            for child in self.featsbyparent[parentid]:
                parent.add_child(child, rangecheck=self.strict)

        # Replace top-level multi-feature reps with a pseudo-feature
        for n, record in enumerate(self.records):
            if not isinstance(record, Feature):
                continue
            if not record.is_multi:
                continue
            assert record.multi_rep == record
            newrep = sorted(record.siblings + [record])[0]
            if newrep != record:
                for sib in sorted(record.siblings + [record]):
                    sib.multi_rep = newrep
                    if sib != newrep:
                        newrep.add_sibling(sib)
                record.siblings = None
            parent = newrep.pseudoify()
            self.records[n] = parent

        if not self.assumesorted:
            for seqid in self.inferred_regions:
                if seqid not in self.declared_regions:
                    seqrange = self.inferred_regions[seqid]
                    srstring = '##sequence-region {:s} {:d} {:d}'.format(
                        seqid, seqrange.start + 1, seqrange.end
                    )
                    seqregion = Directive(srstring)
                    self.records.append(seqregion)

        for record in sorted(self.records):
            yield record
        self._reset()
def _resolve_features ( self ) : for parentid in self . featsbyparent : parent = self . featsbyid [ parentid ] for child in self . featsbyparent [ parentid ] : parent . add_child ( child , rangecheck = self . strict ) for n , record in enumerate ( self . records ) : if not isinstance ( record , Feature ) : continue if not record . is_multi : continue assert record . multi_rep == record newrep = sorted ( record . siblings + [ record ] ) [ 0 ] if newrep != record : for sib in sorted ( record . siblings + [ record ] ) : sib . multi_rep = newrep if sib != newrep : newrep . add_sibling ( sib ) record . siblings = None parent = newrep . pseudoify ( ) self . records [ n ] = parent if not self . assumesorted : for seqid in self . inferred_regions : if seqid not in self . declared_regions : seqrange = self . inferred_regions [ seqid ] srstring = '##sequence-region {:s} {:d} {:d}' . format ( seqid , seqrange . start + 1 , seqrange . end ) seqregion = Directive ( srstring ) self . records . append ( seqregion ) for record in sorted ( self . records ) : yield record self . _reset ( )
Resolve Parent/ID relationships and yield all top-level features.