Skip to content
Open
Changes from all 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
75 changes: 68 additions & 7 deletions BINF2025_TP4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyOkaYHMV5kAI2JXjqDKbiVa",
"include_colab_link": true
"provenance": []
},
"kernelspec": {
"name": "python3",
Expand All @@ -19,8 +17,7 @@
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/pparutto/BINF2025_TP4/blob/main/BINF2025_TP4.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
Expand Down Expand Up @@ -184,14 +181,50 @@
{
"cell_type": "code",
"source": [
"#Votre code ici"
"def mark_columns(A: list, alpha: float) -> list :\n",
" n = len(A[0])\n",
" colomns_mark = []\n",
" for i in range(n):\n",
" cpt_trou = 0\n",
" for j in range(len(A)):\n",
" if A[j][i] == '-':\n",
" cpt_trou += 1\n",
" if cpt_trou < alpha:\n",
" colomns_mark.append(i)\n",
" return colomns_mark"
],
"metadata": {
"id": "ikf5pcUtRYvV"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"A = ['AT-G', 'AATC', 'ACAG']\n",
"alpha = 1\n",
"\n",
"print(mark_columns(A, alpha))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "8YO0PjTgH5dV",
"outputId": "903e5627-fca4-4743-fe05-375c59d8ef6e"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"[0, 1, 3]\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -230,6 +263,34 @@
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"def createT(A: list, alpha: float):\n",
" N = mark_columns(A, alpha)\n",
" T = [[1 for _ in range((N + 1) * 9)] for _ in range((N + 1) * 9)]\n",
" for i in range((N + 1) * 9):\n",
" T[i][0] = 0\n",
" if i % 3 == 0:\n",
" T[i][((N + 1) * 9) - 1] = 0\n",
" return T\n",
"\n",
"def createeM(A: list, alpha: float):\n",
" N = mark_columns(A, alpha)\n",
" eM = [[1 for _ in range((N + 1) * 20)] for _ in range((N + 1) * 20)]\n",
" for i in range((N + 1) * 9):\n",
" eM[0][i] = 0\n",
"\n",
"def createeI(A: list, alpha: float):\n",
" N = mark_columns(A, alpha)\n",
" eI = [[1 for _ in range((N + 1) * 20)] for _ in range((N + 1) * 20)]"
],
"metadata": {
"id": "NVcQQChMMpl-"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
Expand Down Expand Up @@ -344,4 +405,4 @@
"outputs": []
}
]
}
}