Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the SNPObject to store LAI data at the SNP-level + add mehod to go from window-level to SNP-level in the WindowLevelAncestryObject #15

Merged
merged 12 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions demos/LAI_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "50752deb-9a50-4725-90dc-0d10005e1bbb",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -50,26 +50,64 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "84b99b1d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO:snputils.ancestry.io.local.read.msp:Reading '/home/miriam/Documents/snputils/data/lai.msp'...\n"
"INFO:snputils.ancestry.io.local.read.msp:Reading '../data/easComp_6_samples_chr1.msp'...\n"
]
}
],
"source": [
"# Specify the path to the LAI data file\n",
"filename = '/home/miriam/Documents/snputils/data/lai.msp'\n",
"filename = '../data/easComp_6_samples_chr1.msp'\n",
"\n",
"# Load LAI data using MSPReader, which returns a LocalAncestryObject\n",
"laiobj = MSPReader(filename).read()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "681b9362",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['GA000856_GA000856.0',\n",
" 'GA000856_GA000856.1',\n",
" 'GA000857_GA000857.0',\n",
" 'GA000857_GA000857.1',\n",
" 'GA000858_GA000858.0',\n",
" 'GA000858_GA000858.1']"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"laiobj.haplotypes"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "e4aa1fdb",
"metadata": {},
"outputs": [],
"source": [
"# Construct haplotypes and LAI data\n",
"samples = list(range(10))\n",
"haplotypes = [f\"{sample}_{sample}.0\" for sample in samples] + [f\"{sample}_{sample}.1\" for sample in samples]"
]
},
{
"cell_type": "markdown",
"id": "da3a5b0f-dee8-4e1d-ae74-ab2a0fa1c4b0",
Expand Down Expand Up @@ -148,7 +186,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "galaxybio",
"display_name": "snputils",
"language": "python",
"name": "python3"
},
Expand Down
Loading
Loading