Ejemplo n.º 1
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace, All the arguments that were provided to this
        command invocation.

    Returns:
      A list of variants that meet the search criteria.
    """
        genomics_util.ValidateLimitFlag(args.limit)
        genomics_util.ValidateLimitFlag(args.limit_calls, 'limit_calls')

        apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
        req_class = (self.context[
            lib.GENOMICS_MESSAGES_MODULE_KEY].SearchVariantsRequest)
        request = req_class(variantSetIds=[args.variant_set_id],
                            callSetIds=args.call_set_ids,
                            variantName=args.variant_name,
                            referenceName=args.reference_name,
                            start=args.start,
                            end=args.end,
                            maxCalls=args.limit_calls)
        return apitools_base.list_pager.YieldFromList(
            apitools_client.variants,
            request,
            limit=args.limit,
            method='Search',
            batch_size_attribute='pageSize',
            batch_size=args.limit,  # Use limit if any, else server default.
            field='variants')
Ejemplo n.º 2
0
    def Run(self, args):
        """Run 'callsets list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The list of callsets matching the given variant set ids.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        genomics_util.ValidateLimitFlag(args.limit)

        apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
        req_class = (self.context[
            lib.GENOMICS_MESSAGES_MODULE_KEY].SearchCallSetsRequest)
        request = req_class(name=args.name, variantSetIds=args.variant_set_ids)
        res = apitools_base.list_pager.YieldFromList(
            apitools_client.callsets,
            request,
            method='Search',
            limit=args.limit,
            batch_size_attribute='pageSize',
            batch_size=None,  # Use server default.
            field='callSets')

        return res
Ejemplo n.º 3
0
    def Run(self, args):
        """Run 'datasets list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The list of datasets for this project.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        genomics_util.ValidateLimitFlag(args.limit)

        apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
        req_class = (self.context[
            lib.GENOMICS_MESSAGES_MODULE_KEY].GenomicsDatasetsListRequest)
        request = req_class(projectId=genomics_util.GetProjectId())
        return apitools_base.list_pager.YieldFromList(
            apitools_client.datasets,
            request,
            limit=args.limit,
            batch_size_attribute='pageSize',
            batch_size=args.limit,  # Use limit if any, else server default.
            field='datasets')
Ejemplo n.º 4
0
    def Run(self, args):
        """Run 'operations list'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The list of operations for this project.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    """
        genomics_util.ValidateLimitFlag(args.limit)

        apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
        genomics_messages = self.context[lib.GENOMICS_MESSAGES_MODULE_KEY]

        if args.where:
            args.where += ' AND '

        args.where += 'projectId=%s' % genomics_util.GetProjectId()

        request = genomics_messages.GenomicsOperationsListRequest(
            name='operations', filter=args.where)

        return apitools_base.list_pager.YieldFromList(
            apitools_client.operations,
            request,
            limit=args.limit,
            batch_size_attribute='pageSize',
            batch_size=args.limit,  # Use limit if any, else server default.
            field='operations')