Пример #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.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    Returns:
      an ExportVariantSetResponse
    """
    apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
    genomics_messages = self.context[lib.GENOMICS_MESSAGES_MODULE_KEY]
    enum = genomics_messages.ExportVariantSetRequest.FormatValueValuesEnum
    call_set_ids = args.call_set_ids if args.call_set_ids else []
    project_id = args.bigquery_project
    if not project_id:
      project_id = genomics_util.GetProjectId()
    request = genomics_messages.GenomicsVariantsetsExportRequest(
        variantSetId=args.id,
        exportVariantSetRequest=genomics_messages.ExportVariantSetRequest(
            callSetIds=call_set_ids,
            projectId=project_id,
            format=enum.FORMAT_BIGQUERY,
            bigqueryDataset=args.bigquery_dataset,
            bigqueryTable=args.table))

    return apitools_client.variantsets.Export(request)
Пример #2
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')
Пример #3
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')
Пример #4
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.

    Raises:
      HttpException: An http error response was received while executing api
          request.
    Returns:
      None
    """
        apitools_client = self.context[lib.GENOMICS_APITOOLS_CLIENT_KEY]
        genomics_messages = self.context[lib.GENOMICS_MESSAGES_MODULE_KEY]

        dataset = genomics_messages.Dataset(
            name=args.name,
            projectId=genomics_util.GetProjectId(),
        )

        return apitools_client.datasets.Create(dataset)