示例#1
0
文件: base.py 项目: wkopp/CoolBox
    def __init__(self, properties_dict={}, **kwargs):
        # TODO replace properties_dict with **kwargs ? Then the initialization in all classes are unified
        properties = Track.DEFAULT_PROPERTIES.copy()
        properties.update(properties_dict)
        properties.update(kwargs)
        self.properties = format_properties(properties)

        name = self.properties.get('name')
        if name:
            assert isinstance(name, str), "Track name must be a `str`."
        else:
            name = self.__class__.__name__ + ".{}".format(
                self.__class__.counts)
        Track.tracks[name] = self
        self.properties['name'] = name
        self.name = name

        # disable call mixin class
        # super().__init__()
        self.coverages = []

        # load features from global feature stack
        features_stack = get_feature_stack()
        for features in features_stack:
            self.properties.update(features.properties)

        # load coverages from global coverages stack
        coverage_stack = get_coverage_stack()
        for coverage in coverage_stack:
            self.coverages.append(coverage)

        self.ax = None
示例#2
0
文件: track.py 项目: pythseq/CoolBox
    def __init__(self, properties_dict):
        self.properties = properties_dict
        self.__bool2str()
        name = self.properties.get('name')
        if name is not None:
            assert isinstance(name, str), "Track name must be a `str`."
        else:
            name = self.__class__.__name__ + ".{}".format(
                self.__class__._counts)
        self.properties['name'] = name
        super().__init__()
        self.coverages = []

        # load features from global feature stack
        features_stack = get_feature_stack()
        for features in features_stack:
            self.properties[features.key] = features.value

        # load coverages from global coverages stack
        coverage_stack = get_coverage_stack()
        for coverage in coverage_stack:
            self.coverages.append(coverage)
示例#3
0
文件: base.py 项目: wkopp/CoolBox
 def __enter__(self):
     stack = get_coverage_stack()
     stack.append(self)
     return self
示例#4
0
文件: base.py 项目: wkopp/CoolBox
 def __exit__(self, type, value, traceback):
     stack = get_coverage_stack()
     stack.pop()