Skip to content

Commit 925e875

Browse files
committed
2 parents 2cc5272 + 13b996b commit 925e875

1 file changed

Lines changed: 50 additions & 21 deletions

File tree

module_notebooks/07-variant-calling-with-vg.ipynb

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"cell_type": "markdown",
1313
"metadata": {},
1414
"source": [
15-
"# Variant Calling with vg"
15+
"# Variant Calling with VG"
1616
]
1717
},
1818
{
@@ -38,7 +38,7 @@
3838
"cell_type": "markdown",
3939
"metadata": {},
4040
"source": [
41-
"## Get Started\n",
41+
"## Getting Started\n",
4242
"\n",
4343
"When calling variants, we use aligned reads to find support for variants contained in the graph. For the original pangenome graph, it will find variants from the assemblies used to make the graph. You can also augment the pangenome graph with novel variants in the reads, creating an augemented pangenome graph that can be used to call variants.\n",
4444
"\n",
@@ -57,9 +57,9 @@
5757
"\n",
5858
"## Call Variants\n",
5959
"\n",
60-
"We will look for two variant types:</mark\n",
60+
"We will look for two variant types:\n",
6161
"- Variants that are supported by the graph.\n",
62-
"- Variants that are novel (i.e., not in the graph but supported by the reads aligned to the graph).\n",
62+
"- Variants that are novel (i.e. not in the graph but supported by the reads aligned to the graph).\n",
6363
"\n",
6464
"We will call variants against the graph, though you could also call variants using the surjected BAM file and traditional variant calling methods."
6565
]
@@ -94,10 +94,10 @@
9494
"The parameters:\n",
9595
"\n",
9696
"`-x` the graph \n",
97-
"`-g` aligments in gam format \n",
97+
"`-g` aligments in GAM format \n",
9898
"`-Q` ignore mapping and base qualities < N \n",
9999
"`-s` ignore the first and last N nucleotides of each read \n",
100-
"`-o` the output pack file \n",
100+
"`-o` the output PACK file \n",
101101
"`-t` use N threads"
102102
]
103103
},
@@ -119,11 +119,10 @@
119119
"The parameters:\n",
120120
"\n",
121121
"`-k` The read support file to read in \n",
122-
"`-t` The number of threads\n",
122+
"`-t` The number of threads \n",
123123
"`-z` Restrict the search to GBZ haplotypes (can improve speed and accuracy); we won't use this here\n",
124124
"\n",
125-
"Also, feed in the graph as a positional argument: \n",
126-
"*graphs/yprp.chrVIII.pggb.giraffe.gbz*"
125+
"Also, feed in the graph as a positional argument: *graphs/yprp.chrVIII.pggb.giraffe.gbz*"
127126
]
128127
},
129128
{
@@ -224,6 +223,17 @@
224223
"# Statistics for variants supported by the full genome graph"
225224
]
226225
},
226+
{
227+
"cell_type": "markdown",
228+
"metadata": {},
229+
"source": [
230+
"<details>\n",
231+
"<summary>Click for help</summary>\n",
232+
"<br>\n",
233+
"!bcftools stats variants/yprp.fullgenome.pggb.graph_calls.vcf | grep \"^SN\"\n",
234+
"</details>"
235+
]
236+
},
227237
{
228238
"cell_type": "markdown",
229239
"metadata": {},
@@ -232,7 +242,7 @@
232242
"\n",
233243
"## Including Novel Variant Calls\n",
234244
"\n",
235-
"1. To call novel variants (i.e., those variants supported by the aligned reads), we need to embed the variation from the reads we aligned back into the graph. To do this we need to convert the graph into a form that we can change. We will use `vg convert` to convert the .gbz file to a .vg file."
245+
"1. To call novel variants (i.e. those variants supported by the aligned reads), we need to embed the variation from the reads we aligned back into the graph. To do this we need to convert the graph into a form that we can change. We will use `vg convert` to convert the .gbz file to a .vg file."
236246
]
237247
},
238248
{
@@ -255,7 +265,7 @@
255265
"`-A` new, augmented graph with aligned reads \n",
256266
"`-t` the number of threads to use \n",
257267
"\n",
258-
"Also, feed in the the graph and the input alignment (gam) file as positional arguments: \n",
268+
"Also, feed in the the graph and the input alignment (GMA) file as positional arguments: \n",
259269
"*graphs/yprp.chrVIII.pggb.giraffe.vg* \n",
260270
"*alignments/SK1xyprp.chrVIII.pggb.mapped.gam*"
261271
]
@@ -345,12 +355,12 @@
345355
"cell_type": "markdown",
346356
"metadata": {},
347357
"source": [
348-
"<div class=\"alert alert-block alert-success\"> <b>Try this in the cells below:</b> \n",
358+
"<div class=\"alert alert-block alert-success\"> <b>Try this in the cells below:</b><br/>\n",
359+
"Call novel variants for the full genome graph (yprp.fullgenome.pggb.giraffe.gbz) by performing the following steps:\n",
349360
" <ul>\n",
350-
" Call novel variants for the full genome graph (*yprp.fullgenome.pggb.giraffe.gbz*) by performing the following steps:\n",
351-
" <li>Convert the graph to vg format.</li>\n",
361+
" <li>Convert the graph to .vg format.</li>\n",
352362
" <li>Augment the graph to embed the read alignments.</li>\n",
353-
" <li>Create an index (xg).</li>\n",
363+
" <li>Create an index (.xg).</li>\n",
354364
" <li>Compute read support.</li>\n",
355365
" <li>Generate a VCF.</li>\n",
356366
" <li>Generate statistics.</li>\n",
@@ -434,6 +444,25 @@
434444
"</details>"
435445
]
436446
},
447+
{
448+
"cell_type": "code",
449+
"execution_count": null,
450+
"metadata": {},
451+
"outputs": [],
452+
"source": [
453+
"!vg convert graphs/yprp.fullgenome.pggb.giraffe.gbz > graphs/yprp.fullgenome.pggb.giraffe.vg\n",
454+
"\n",
455+
"!vg augment graphs/yprp.fullgenome.pggb.giraffe.vg alignments/SK1xyprp.fullgenome.pggb.mapped.gam -A alignments/SK1xyprp.fullgenome.pggb.mapped.aug.gam -t 4 > graphs/SK1xyprp.fullgenome.pggb.aug.vg\n",
456+
"\n",
457+
"!vg index -t 4 -x graphs/SK1xyprp.fullgenome.pggb.aug.xg graphs/SK1xyprp.fullgenome.pggb.aug.vg\n",
458+
"\n",
459+
"!vg pack -x graphs/SK1xyprp.fullgenome.pggb.aug.xg -g alignments/SK1xyprp.fullgenome.pggb.mapped.aug.gam -Q 5 -s 5 -o alignments/SK1xyprp.fullgenome.pggb.mapped.aug.pack -t 4\n",
460+
"\n",
461+
"!vg call graphs/SK1xyprp.fullgenome.pggb.aug.xg -k alignments/SK1xyprp.fullgenome.pggb.mapped.aug.pack -t 4 > variants/SK1xyprp.fullgenome.pggb.aug_calls.vcf\n",
462+
"\n",
463+
"!bcftools stats variants/SK1xyprp.fullgenome.pggb.aug_calls.vcf | grep \"^SN\""
464+
]
465+
},
437466
{
438467
"cell_type": "markdown",
439468
"metadata": {},
@@ -479,7 +508,7 @@
479508
]
480509
},
481510
{
482-
"cell_type": "raw",
511+
"cell_type": "markdown",
483512
"metadata": {},
484513
"source": [
485514
"We will use the original chrVIII graph and export variants onto the S288C paths."
@@ -552,7 +581,7 @@
552581
"\n",
553582
"## Visualize the original and augmented graphs\n",
554583
"\n",
555-
"1. Compare CUP1 region of the original graph (yprp.chrVIII.pggb.gfa) and augmented graph (SK1xyprp.chrVIII.pggb.aug.vg, which we will convert to SK1xyprp.chrVIII.pggb.aug.gfa) in bandage. First, convert the augmented graph to gfa format.\n",
584+
"1. Compare CUP1 region of the original graph (yprp.chrVIII.pggb.gfa) and augmented graph (SK1xyprp.chrVIII.pggb.aug.vg, which we will convert to SK1xyprp.chrVIII.pggb.aug.gfa) in Bandage. First, convert the augmented graph to GFA format.\n",
556585
"\n",
557586
"The parameters:\n",
558587
"\n",
@@ -577,7 +606,7 @@
577606
"source": [
578607
"2. Then visualize the CUP1 region of each .gfa file in bandage.\n",
579608
"\n",
580-
"<div class=\"alert alert-block alert-info\"> <b>NOTE:</b> The augmented graph is much bigger and it will have difficulty loading the entire chrVIII graph. So, before drawing the graph, blast the genes. Change the \"Scope\" to \"Around query hits\". Change \"Distance\" to 200 for the augmented graph. Then click \"Draw Graph\". \n"
609+
"<div class=\"alert alert-block alert-info\"> <b>NOTE:</b> The augmented graph is much bigger and it will have difficulty loading the entire chrVIII graph. So, before drawing the graph, BLAST the genes, then change the \"Scope\" to \"Around query hits,\" and change \"Distance\" to 200 for the augmented graph. Finally, click \"Draw Graph\" to apply these changes.</div>\n"
581610
]
582611
},
583612
{
@@ -647,7 +676,7 @@
647676
"\n",
648677
"Congratulations, you have completed the pangenomics module!\n",
649678
"\n",
650-
"In this module, you learned about pangenomics and used a yeast dataset to build pangenomics graphs using PGGB. You learned how to search these graphs for regions that match DNA sequence queries using BLAST and how to interactively visualize these graphs using Bandage. In addition, you learned how to index the graphs, map reads to the graphs, and call variants. Well done!\n",
679+
"In this module, you learned about pangenomics and used a yeast dataset to build pangenomics graphs using PGGB. You learned how to search these graphs for regions that match DNA sequence queries using BLAST and how to interactively visualize these graphs using Bandage. In addition, you learned how to use VG to index the graphs, map reads to the graphs, and call variants. Well done!\n",
651680
"\n",
652681
"----------------------"
653682
]
@@ -670,7 +699,7 @@
670699
],
671700
"metadata": {
672701
"kernelspec": {
673-
"display_name": "nigms-pangenomics",
702+
"display_name": "nigms-pangenomics (Local) (Local)",
674703
"language": "python",
675704
"name": "conda-env-nigms-pangenomics-nigms-pangenomics"
676705
},
@@ -684,7 +713,7 @@
684713
"name": "python",
685714
"nbconvert_exporter": "python",
686715
"pygments_lexer": "ipython3",
687-
"version": "3.12.9"
716+
"version": "3.12.10"
688717
}
689718
},
690719
"nbformat": 4,

0 commit comments

Comments
 (0)