Esempio n. 1
0
    def test_build_hisat2_index_from_assembly_ok(self):
        manager = Hisat2IndexManager(self.wsURL, self.callback_url,
                                     self.scratch)
        ws = Workspace(self.wsURL)
        genome_obj_info = ws.get_objects2({
            'objects': [{
                'ref': self.genome_ref
            }],
            'no_data': 1
        })
        # get the list of genome refs from the returned info.
        # if there are no refs (or something funky with the return), this will be an empty list.
        # this WILL fail if data is an empty list. But it shouldn't be, and we know because
        # we have a real genome reference, or get_objects2 would fail.
        genome_obj_refs = genome_obj_info.get('data', [{}])[0].get('refs', [])

        # see which of those are of an appropriate type (ContigSet or Assembly), if any.
        assembly_ref = list()
        ref_params = [{'ref': x} for x in genome_obj_refs]
        ref_info = ws.get_object_info3({'objects': ref_params})
        for idx, info in enumerate(ref_info.get('infos')):
            if "KBaseGenomeAnnotations.Assembly" in info[
                    2] or "KBaseGenomes.ContigSet" in info[2]:
                assembly_ref.append(";".join(ref_info.get('paths')[idx]))
        assembly_ref = assembly_ref[0]
        idx_prefix = manager.get_hisat2_index(assembly_ref)
        self.assertIn("kb_hisat2_idx", idx_prefix)
Esempio n. 2
0
 def build_index(self, object_ref):
     """
     Uses the Hisat2IndexManager to build/retrieve the HISAT2 index files
     based on the object ref.
     """
     idx_manager = Hisat2IndexManager(self.workspace_url, self.callback_url,
                                      self.working_dir)
     return idx_manager.get_hisat2_index(object_ref)
Esempio n. 3
0
 def test_build_hisat2_index_from_assembly_ok(self):
     manager = Hisat2IndexManager(self.wsURL, self.callback_url,
                                  self.scratch)
     idx_prefix = manager.get_hisat2_index(self.assembly_ref)
     self.assertIn("kb_hisat2_idx", idx_prefix)
Esempio n. 4
0
 def test_build_hisat2_index_no_object(self):
     manager = Hisat2IndexManager(self.wsURL, self.callback_url,
                                  self.scratch)
     with self.assertRaises(ValueError) as err:
         manager.get_hisat2_index(self.single_end_ref_wt_1)
         self.assertIn("Missing reference object", err.exception)