def test_gene_history_loader(self):
        """ Test the gene history loading. """
        call_command("pipeline", "--steps", "load", sections="GENE_HISTORY", dir=TEST_DATA_DIR, ini=MY_INI_FILE)

        INI_CONFIG = IniParser().read_ini(MY_INI_FILE)
        idx = INI_CONFIG["GENE_HISTORY"]["index"]
        idx_type = INI_CONFIG["GENE_HISTORY"]["index_type"]
        elastic = Search(idx=idx, idx_type=idx_type)
        Search.index_refresh(idx)

        self.assertTrue(elastic.get_count()["count"] > 1, "Count documents in the index")
        map1_props = Gene.gene_history_mapping(idx, idx_type, test_mode=True).mapping_properties
        map2_props = elastic.get_mapping()
        if idx not in map2_props:
            logger.error("MAPPING ERROR: " + json.dumps(map2_props))
        self._cmpMappings(map2_props[idx]["mappings"], map1_props, idx_type)
Пример #2
0
 def gene_history_parse(cls, *args, **kwargs):
     ''' Parse gene_history file from NCBI. '''
     download_file = cls._get_download_file(*args, **kwargs)
     Gene.gene_history_mapping(kwargs['section']['index'], kwargs['section']['index_type'])
     with gzip.open(download_file, 'rt') as gene_his_f:
         Gene.gene_history_parse(gene_his_f, kwargs['section']['index'], kwargs['section']['index_type'])