Skip to content

Commit

Permalink
Code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mourisl committed Sep 7, 2024
1 parent f0b7eb1 commit ddb7137
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions vizMSA_dev.ipynb
Original file line number Diff line number Diff line change
@@ -44,7 +44,26 @@
},
{
"cell_type": "code",
"execution_count": 251,
"execution_count": null,
"id": "f8508020-34de-4cd6-8988-8bc1d57990c9",
"metadata": {},
"outputs": [],
"source": [
"def GetStartEnd(msa, start, end):\n",
" length = len(msa[0])\n",
" if (start == None):\n",
" start = 0\n",
" elif (start < 0):\n",
" start = length + start \n",
" if (end == None):\n",
" end = length - 1 \n",
" elif (end < 0):\n",
" end = length + end "
]
},
{
"cell_type": "code",
"execution_count": 253,
"id": "37d12119-b410-453a-8ce4-ee254fb4b957",
"metadata": {},
"outputs": [],
@@ -61,14 +80,7 @@
" length = len(msa[0])\n",
" \n",
" # start, end: draw the [start,end] (both inclusive) region of the MSA\n",
" if (start == None):\n",
" start = 0\n",
" elif (start < 0):\n",
" start = length + start \n",
" if (end == None):\n",
" end = length - 1 \n",
" elif (end < 0):\n",
" end = length + end \n",
" start, end = GetStartEnd(msa, start, end)\n",
" \n",
" if (axlim == None):\n",
" # Strange, why cols should be length, not end-start+1?\n",
@@ -123,20 +135,32 @@
" return ax"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "36e9ef94-9873-4ff2-9813-4ff62a4e575b",
"metadata": {},
"outputs": [],
"source": [
"def GetConsensus(msa, start = None, end = None):\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8ca0d92-042e-4082-82b2-795084714cf5",
"metadata": {},
"outputs": [],
"source": [
"def DrawMSAConsensus(msa, start = None, end = None):\n",
" return"
"def DrawMSAConsensusHisto(msa, start = None, end = None, ax=None):\n",
" ax = ax or plt.gca()\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 247,
"execution_count": 255,
"id": "9857702b-904f-4aa8-a330-d867bb91afd0",
"metadata": {},
"outputs": [
@@ -152,6 +176,8 @@
}
],
"source": [
"ax = plt.gca()\n",
"ax.set(xlim=[-20,20], ylim=[-20, 20])\n",
"ax=DrawMSA(msa=[\"AC-G-T\", \"A-CGT-\"], seq_names = [\"r1\", \"r2\"],\n",
" start = 1, end = 3, color_order=\"ACGT-\")"
]

0 comments on commit ddb7137

Please sign in to comment.