Skip to content

Commit

Permalink
Guppy Basecall and Demux process using Google Colab
Browse files Browse the repository at this point in the history
  • Loading branch information
lpmor22 committed Apr 21, 2024
1 parent ea1c22d commit a088f1c
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions google_colab/ont_guppy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"gpuType": "T4"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "gxcweSl4fmRz"
},
"outputs": [],
"source": [
"# Initiate GPU runtime\n",
"\n",
"import tensorflow as tf\n",
"tf.test.gpu_device_name()\n",
"\n",
"import torch\n",
"torch.cuda.get_device_name(0)\n",
"\n",
"!rm -rf sample_data"
]
},
{
"cell_type": "code",
"source": [
"# Install Guppy (Oxford Nanopore Technologies)\n",
"\n",
"%%shell\n",
"\n",
"GUPPY_VERSION=6.5.7 # Archived Software\n",
"\n",
"wget https://cdn.oxfordnanoportal.com/software/analysis/ont-guppy_\"$GUPPY_VERSION\"_linux64.tar.gz -O ont-guppy.tar.gz\n",
"tar -vzxf ont-guppy.tar.gz; rm -rf ont-guppy.tar.gz\n",
"./ont-guppy/bin/guppy_basecaller --version"
],
"metadata": {
"id": "dSavIZSzhTlP"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Import Google Drive\n",
"\n",
"from google.colab import drive\n",
"drive.mount('/content/gdrive', force_remount=True)\n",
"\n",
"!ls gdrive/MyDrive"
],
"metadata": {
"id": "i6QNwjcWlX7L"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Basecall and Demultiplex process\n",
"\n",
"%%shell\n",
"\n",
"# Specify the name of the folder (i.e., 20240411_1608_MN22990_FAT84733_f175dd69/fast5)\n",
"DIR=\"20240411_1608_MN22990_FAT84733_f175dd69/fast5\"\n",
"\n",
"# Specify the barcode kit used for library preparation\n",
"BARKIT=\"EXP-NBD114\"\n",
"\n",
"PREFIX=\"$(echo \"$IDIR\" | awk -F/ '{print $1}')\"\n",
"\n",
"# Specify the accurate basecalling model - fast (fast), high (hac) or super (sup) accuracy\n",
"# dna_r9.4.1_450bps_fast.cfg\n",
"# dna_r9.4.1_450bps_hac.cfg\n",
"# dna_r9.4.1_450bps_sup.cfg\n",
"./ont-guppy/bin/guppy_basecaller -r --device cuda:0 --verbose_logs \\\n",
"-i \"$IDIR\" -s \"$PREFIX\"_GUPPY-BASECALL --min_qscore 8 \\\n",
"-c \"ont-guppy/data/dna_r9.4.1_450bps_fast.cfg\" \\\n",
"--gpu_runners_per_device 16 --cpu_threads_per_caller $(nproc)\n",
"\n",
"./ont-guppy/bin/guppy_barcoder -r --trim_adapters --barcode_kits \"$BARKIT\" \\\n",
"-i \"$PREFIX\"_GUPPY-FAST -s \"$PREFIX\"_GUPPY-DEMUX -t $(nproc)"
],
"metadata": {
"id": "3h3DJ72AH1I9"
},
"execution_count": null,
"outputs": []
}
]
}

0 comments on commit a088f1c

Please sign in to comment.