Exemplo n.º 1
0
    def _check_get_expression_set_params(self, params):
        if 'ref' not in params or params['ref'] is None:
            raise ValueError('"ref" parameter field specifiying the expression set is required')
        elif not util.check_reference(params['ref']):
            raise ValueError('"ref" parameter must be a valid workspace reference')
        if 'include_item_info' in params:
            if params['include_item_info'] not in [0, 1]:
                raise ValueError('"include_item_info" parameter field can only be set to 0 or 1')
        obj_spec = util.build_ws_obj_selector(params.get('ref'),
                                              params.get('ref_path_to_set', []))
        info = self.workspace_client.get_object_info3({"objects": [obj_spec]})

        return info["infos"][0][2], obj_spec
Exemplo n.º 2
0
    def _get_set_info(self, set_refs):
        objects = []
        for s in set_refs:
            objects.append(
                util.build_ws_obj_selector(s['ref'], s.get('path_to_set', [])))

        if len(objects) > 0:
            obj_info_list = self.ws.get_object_info_new({
                'objects': objects,
                'includeMetadata': 1
            })
            set_list = []
            for o in obj_info_list:
                set_list.append({'ref': self._build_obj_ref(o), 'info': o})
        return set_list
Exemplo n.º 3
0
    def _populate_item_object_info(self, set, ref_path_to_set):

        items = set['data']['items']

        objects = []
        for item in items:
            ref_path_to_item = ref_path_to_set + [item['ref']]
            objects.append(
                util.build_ws_obj_selector(item['ref'], ref_path_to_item))

        if len(objects) > 0:
            obj_info_list = self.ws.get_object_info_new({
                'objects': objects,
                'includeMetadata': 1
            })

            for k in range(0, len(obj_info_list)):
                items[k]['info'] = obj_info_list[k]
Exemplo n.º 4
0
    def get_set(self,
                ref,
                include_item_info=False,
                ref_path_to_set=[],
                include_set_item_ref_paths=False):
        """
        Get a set object from the Workspace using the set_type provided (e.g. set_type=KBaseSets.ReadsSet)
        """
        obj_selector = util.build_ws_obj_selector(ref, ref_path_to_set)
        ws_data = self._get_set_from_ws(obj_selector)

        if include_item_info:
            self._populate_item_object_info(ws_data, ref_path_to_set)

        if include_set_item_ref_paths:
            set_items = ws_data['data']['items']
            util.populate_item_object_ref_paths(set_items, obj_selector)

        return ws_data