Memproses data genomik menggunakan Cloud Life Sciences
Halaman ini menjelaskan cara menjalankan pipeline genomik yang menggunakan Cloud Life Sciences API untuk membuat file indeks (file BAI) dari file biner yang berisi urutan DNA (file BAM).
File BAM biasanya berukuran besar dan memerlukan waktu yang lama untuk dibaca menggunakan penampil genom. Anda menggunakan file BAI untuk menemukan bagian file BAM yang berisi posisi genom yang Anda minati.
Sebelum memulai
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Cloud Life Sciences, Compute Engine, and Cloud Storage JSON APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Cloud Life Sciences, Compute Engine, and Cloud Storage JSON APIs.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
- Instal Python 3.8.
Jika Anda menggunakan Windows dan membiarkan kotak yang relevan dicentang saat menginstal Google Cloud CLI, ini dilakukan secara otomatis.
Atau, Anda dapat menggunakan Cloud Shell, yang dilengkapi dengan gcloud CLI yang sudah terinstal.
Menjalankan pipeline
Untuk menjalankan pipeline, selesaikan langkah-langkah berikut:
Buat bucket tempat Anda menyimpan file BAI. Bucket adalah container dasar yang menyimpan data Anda di Cloud Storage. Untuk membuat bucket bernama
PROJECT_ID-life-sciences
, jalankan perintahgcloud storage buckets create
:gcloud storage buckets create gs://PROJECT_ID-life-sciences
Ganti PROJECT_ID dengan Google Cloud project ID Anda. Anda harus menggunakan nama bucket yang unik secara global.
Jika berhasil, perintah akan menampilkan:
Creating gs://PROJECT_ID-life-sciences
Untuk memulai pipeline, jalankan perintah
gcloud beta lifesciences pipelines run
:gcloud beta lifesciences pipelines run \ --regions us-east1 \ --command-line 'samtools index ${BAM} ${BAI}' \ --docker-image "gcr.io/cloud-lifesciences/samtools" \ --inputs BAM=gs://genomics-public-data/NA12878.chr20.sample.bam \ --outputs BAI=gs://PROJECT_ID-life-sciences/NA12878.chr20.sample.bam.bai
Jika berhasil, perintah akan menampilkan:
Running [projects/PROJECT_ID/operations/OPERATION_ID]
Catat OPERATION_ID, yang akan Anda gunakan di langkah berikutnya.
Untuk melacak status pipeline, jalankan perintah
gcloud beta lifesciences operations wait
. Ganti OPERATION_ID dengan nilai yang dicetak pada langkah sebelumnya. Pipeline memerlukan waktu beberapa menit untuk diselesaikan.gcloud beta lifesciences operations wait OPERATION_ID
Setelah operasi selesai, pesan berikut akan ditampilkan:
Waiting for [projects/PROJECT_ID/operations/OPERATION_ID]...done.
Untuk memverifikasi bahwa file BAI telah dibuat, jalankan perintah
gcloud storage ls
:gcloud storage ls gs://PROJECT_ID-life-sciences
Jika berhasil, perintah akan menampilkan:
gs://PROJECT_ID-life-sciences/NA12878.chr20.sample.bam.bai
Anda telah menjalankan pipeline menggunakan Cloud Life Sciences API untuk membuat file BAI dari file BAM. Gunakan penampil genom untuk memeriksa file BAM NA12878.chr20.sample.bam
menggunakan file indeks NA12878.chr20.sample.bam.bai
.
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.
Hapus file BAI
Untuk menghapus file BAI yang dibuat, tetapi tetap menyimpan project dan bucket yang Anda buat, jalankan perintah gcloud storage rm
:
gcloud storage rm PROJECT_ID-life-sciences/NA12878.chr20.sample.bam.bai
Menghapus bucket
Jika Anda membuat bucket khusus untuk panduan memulai ini dan tidak lagi
memerlukannya, tetapi ingin mempertahankan project, hapus bucket menggunakan
perintah gcloud storage rm
. Menghapus
bucket juga akan menghapus file BAI yang dihasilkan.
gcloud storage rm gs://PROJECT_ID-life-sciences --recursive
Menghapus project
Jika Anda membuat project khusus untuk panduan memulai ini dan tidak memerlukannya lagi, Anda dapat menghapus project tersebut. Menghapus project juga akan menghapus file BAI dan bucket Cloud Storage.
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
Bagaimana hasilnya?
Langkah berikutnya
- Pelajari lebih lanjut set data publik Cloud Life Sciences API.
- Pelajari cara memuat data varian ke Cloud Storage atau BigQuery.
- Pelajari cara menganalisis varian dengan BigQuery.