示例#1
0
 def __init__(self):
     """
     options should contain the following name-value pairs as a dict: 
     
     Create a new instance of Annotator.
     
     In order to specify the input and output creators and datasources, use the set and addDatasource methods.
     
     """
     self._inputCreator = None
     self._outputRenderer = None
     self._datasources = []
     self.logger = logging.getLogger(__name__)
     self._manualAnnotations = dict()
     self._defaultAnnotations = dict()
     self._isMulticore = None
     self._numCores = None
     self._cacheManager = CacheManager()
     self._cacheManager.initialize(None, "not_used")
     self._cache_stats = {"miss": 0, "hit": 0}
     self._is_skip_no_alts = False
     self._annotating_type = None
     self._annotate_func_ptr = Annotator.ANNOTATING_FUNC_DICT.get(
         self._annotating_type, _annotate_mut)
     pass
示例#2
0
 def initialize_cache_manager(self, runSpec):
     """Do not bother calculating the db_dir_key if the cache is not being used. """
     cache_url = runSpec.get_cache_url()
     if cache_url is not None and cache_url != "":
         db_dir_key = self.create_db_dir_key()
         self._cacheManager = CacheManager()
         self._cacheManager.initialize(cache_url, db_dir_key, is_read_only=runSpec.get_is_read_only_cache())
     else:
         db_dir_key = "never_used"
         self._cacheManager = None
示例#3
0
 def test_cached_annots_dummy_cache(self):
     """Test dummy cache.  Also, tests a simple store and retrieve, which should be None."""
     cm = CacheManager()
     fake_db_dir_key = "blah"
     cm.initialize(None, fake_db_dir_key, is_read_only=False)
     m = MutationDataFactory.default_create()
     m.createAnnotation("blah1", "val1", annotationSource="INPUT")
     m.createAnnotation("blah2", "val5", annotationSource="some_datasource")
     cm.store_annotations_in_cache(m)
     annots = cm.retrieve_cached_annotations(m)
     self.assertTrue(annots is None)
示例#4
0
    def test_cached_annots(self):
        """Test to make sure that we are not storing annotations that should not be cached.  Also, tests a simple store and retrieve."""
        cache_file = "out/shove.managertest.annots.cache"
        cm = CacheManager()
        fake_db_dir_key = "blah"
        cm.initialize("file://" + cache_file,
                      fake_db_dir_key,
                      is_read_only=False)
        m = MutationDataFactory.default_create()
        m.createAnnotation("blah1", "val1", annotationSource="INPUT")
        m.createAnnotation("blah2", "val5", annotationSource="some_datasource")
        cm.store_annotations_in_cache(m)
        annots = cm.retrieve_cached_annotations(m)

        self.assertTrue(len(annots.keys()) == 1)
        self.assertTrue(annots["blah2"].getValue() == "val5")