Skip to content

Commit

Permalink
Finished off deconstruct.
Browse files Browse the repository at this point in the history
  • Loading branch information
joannmudge committed Feb 10, 2025
1 parent 87abfd9 commit 5c17737
Showing 1 changed file with 93 additions and 3 deletions.
96 changes: 93 additions & 3 deletions module_notebooks/05-variant-calling-with-vg.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"source": [
"### Call Variants\n",
"\n",
"We will look for variants that are supported by the graph as well as for variants that are novel (not in the graph but supported by the reads aligned to the graph).\n",
"We will look for variants in the aligned reads that are supported by the graph as well as for variants that are novel (not in the graph but supported by the reads aligned to the graph).\n",
"\n",
"We will call variants against the graph, though you could also call variants using the surjected BAM file and traditional variant calling methods."
]
Expand All @@ -58,7 +58,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Calling Graph Supported Variants\n",
"### Calling Graph Supported Variants\n",
"\n",
"Compute read support for variation already in the graph using `vg pack`.\n",
"\n",
Expand Down Expand Up @@ -132,7 +132,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Calling Novel Variants\n",
"### Calling Novel Variants\n",
"\n",
"To call novel variants, 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."
]
Expand Down Expand Up @@ -293,6 +293,90 @@
"</details>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"## Variants used to construct the graph\n",
"\n",
"We can also pull out variants that are in the structure of the graph, which does not require aligning reads from a sample."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First, we will create a .xg formated graph with `vg index`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!vg index -t 4 -x yprp.chrVIII.pggb.xg yprp.chrVIII.pggb.vg"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, grab the variants from the graph using `vg deconstruct`.\n",
"\n",
"The parameters:\n",
"\n",
"Graph (xg)\n",
"-P path prefix (variants will be called for all paths that start with this prefix) \n",
"-t number of threads\n",
"\n",
"NOTE: VG takes liberties with variants when constructing the graph so this VCF might not be identical to those from other methods."
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"We will use the original chrVIII graph and export variants onto the S288C paths."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!vg deconstruct yprp.chrVIII.pggb.xg -P S288C -t 20 > yprp.chrVIII.pggb.S288Cpaths.deconstruct.vcf"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\"> <b>Try this:</b> \n",
" <ul>\n",
" <li>Create a blank code cell below.</li>\n",
" <li>Deconstruct variants from the full genome graph (yprp.fullgenome.pggb.giraffe.vg)</li>\n",
" <li>Hint: first you will need to create and .xg version using `vg index`</li>\n",
" </ul>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<details>\n",
"<summary>Click for help</summary>\n",
"<br>\n",
"!vg index -t 4 -x yprp.fullgenome.pggb.xg yprp.fullgenome.pggb.vg \n",
"\n",
"\n",
"!vg deconstruct yprp.fullgenome.pggb.xg -P S288C -t 20 > yprp.fullgenome.pggb.S288Cpaths.deconstruct.vcf\n",
"</details>"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -312,6 +396,12 @@
}
],
"metadata": {
"environment": {
"kernel": "conda-env-nigms-pangenomics-nigms-pangenomics",
"name": "workbench-notebooks.m127",
"type": "gcloud",
"uri": "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/workbench-notebooks:m127"
},
"kernelspec": {
"display_name": "nigms-pangenomics",
"language": "python",
Expand Down

0 comments on commit 5c17737

Please sign in to comment.