Cloud Life Sciences: Qwik Start

Join Sign in

Cloud Life Sciences: Qwik Start

30 minutes 1 Credit


Google Cloud Skills Boost logo


Cloud Life Sciences (formerly Google Genomics) enables the life sciences community to process biomedical data at scale. Cloud Life Sciences is a suite of services and tools for managing, processing, and transforming life sciences data. It also enables advanced insights and operational workflows using highly scalable and compliant infrastructure.Through this and other add-ons, you can apply the same technologies that power Google Search and Maps to securely store, process, explore, and share large, complex datasets.

In this lab you’ll learn how to run a pipeline that uses the Cloud Life Sciences Pipelines API to create an index file (BAI file) from a large binary file containing DNA sequences (BAM file).


This is an introductory level lab that shows you the basics of setting up and using this Google Cloud service. It assumes little or no prior experience with Cloud Life Sciences.

Setup and Requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.

Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.

Note: If you are using a Chrome OS device, open an Incognito window to run this lab.

How to start your lab and sign in to the Google Cloud Console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.

    Open Google Console

  2. Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.

    Sign in

    Tip: Open the tabs in separate windows, side-by-side.

  3. In the Sign in page, paste the username that you copied from the left panel. Then copy and paste the password.

    Important: You must use the credentials from the left panel. Do not use your Google Cloud Training credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).

  4. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Cloud Console opens in this tab.

Activate Cloud Shell

Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.

In the Cloud Console, in the top right toolbar, click the Activate Cloud Shell button.

Cloud Shell icon

Click Continue.


It takes a few moments to provision and connect to the environment. When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. For example:

Cloud Shell Terminal

gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.

You can list the active account name with this command:

gcloud auth list


ACTIVE: * ACCOUNT: To set the active account, run: $ gcloud config set account `ACCOUNT`

You can list the project ID with this command:

gcloud config list project


[core] project = <project_ID>

(Example output)

[core] project = qwiklabs-gcp-44776a13dea667a6

The Life Sciences API

Enable the Cloud Life Sciences API.

In the Google Cloud console, from the Navigation menu click on APIs & Services > Library:


In the Search for APIs and Services search bar, type "life sciences". Click on the Cloud Life Sciences API tile, then click Enable.

Run the pipeline

  1. Create PROJECT and BUCKET environment variables. The BUCKET variable points to a Cloud Storage bucket that uses your project name with -life-sciences appended:

export PROJECT=$(gcloud info --format='value(config.project)') export BUCKET=gs://${PROJECT}-life-sciences
  1. Create the bucket using the gsutil mb command:

gsutil mb ${BUCKET}

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully created a cloud storage bucket, you will see an assessment score.

Create a Cloud Storage Bucket
  1. Create BAM and BAI environment variables. This BAM variable points to a sample BAM file in a public bucket. The BAI variable points to the output location where the BAI will be saved:

export BAM=gs://genomics-public-data/NA12878.chr20.sample.bam export BAI=${BUCKET}/NA12878.chr20.sample.bam.bai
  1. Run a pipeline using the gcloud command-line tool, providing a BAM file as the input and a BAI file as the output:

gcloud beta lifesciences pipelines run \ --regions us-east1 \ --command-line 'samtools index ${BAM} ${BAI}' \ --docker-image "" \ --inputs BAM=${BAM} \ --outputs BAI=${BAI}

The pipeline invokes the Pipelines API, creates a Compute Engine VM instance, and then runs the pipeline process on the instance. After the process finishes, the instance is automatically shut down and the BAI file is copied to your Cloud Storage bucket.

  1. If successful, the command returns the following:

Running [projects/PROJECT_ID/locations/us-central1/operations/OPERATION_ID]

Copy the OPERATION_ID, you’ll use it in the next step.

  1. The pipeline will take a few minutes to finish. Run the following command to track its status, replacing OPERATION_ID with the value you saved from the previous step:

gcloud beta lifesciences operations wait OPERATION_ID
  1. After the operation finishes, it prints the following message:

Waiting for [projects/PROJECT_ID/operations/OPERATION_ID]...done.

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully run a Genomics pipeline, you will see an assessment score.

Run the Genomics Pipeline
  1. Verify that the BAI file was generated:

gsutil ls ${BUCKET}
  1. The command should return the following:


You've just run a pipeline using the Cloud Life Sciences Pipelines API to create a BAI file from a BAM file.

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully run a Genomics pipeline and processed data is generated in bucket, you will see an assessment score.

Verify that the BAI file is generated

Clean up

All materials for this lab will be removed when you end this lab, but it is good to know how to clean up if you are testing in your own environment.

Use the gsutil rm command to delete the BAI file:

gsutil rm ${BUCKET}/NA12878.chr20.sample.bam.bai

Delete the bucket using the gsutil rb command:

gsutil rb ${BUCKET}

Test Completed Task

Click Check my progress to verify your performed task. If you have successfully deleted a cloud storage bucket, you will see an assessment score.

Clean up (delete the storage bucket)


You have run a pipeline that uses the Cloud Life Sciences Pipelines API to create an index file (BAI file) from a large binary file containing DNA sequences (BAM file).

Take your next lab

This lab is part of a series of labs called Qwik Starts. These labs are designed to give you a little taste of the many features available with Google Cloud. Search for "Qwik Starts" in the lab catalog to find the next lab you'd like to take!

Next Steps / Learn More

  • SAM (Sequence Alignment/Map) is a file format for storing the large nucleotide sequences found in genomes. SAMtools provide various utilities to manipulate these files, such as sorting, merging, indexing and generating data on these sequences. SAMtools is open-source and hosted on GitHub.

  • More information on Cloud Life Sciences.

Google Cloud Training & Certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated October 05, 2021
Lab Last Tested October 05, 2021

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.