Skip to content

Commit

Permalink
finished notebook new cut implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
manulera committed Jan 25, 2024
1 parent c4acf48 commit 9fa5684
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions scripts/cutsite_pairs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note how if the ovhg is negative, for an origin spanning cutsite, the position lies on the left side of the origin, and viceversa."
"Note in the above printed output how if the ovhg is negative, for an origin spanning cutsite, the position lies on the left side of the origin, and viceversa.\n",
"\n",
"Below, you can see that the `cut_watson` is defined with respect to the \"full sequence\""
]
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -124,16 +126,30 @@
"metadata": {},
"source": [
"Cuts are only returned if the recognition site and overhang are on the double-strand part\n",
"of the sequence. Not 100% sure if that's the \"right\" way to do it."
"of the sequence."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[((1, -4), EcoRI)]\n",
"[]\n"
]
}
],
"source": [
"\n"
"\n",
"seq = Dseq('GAATTC')\n",
"print(seq.get_cutsites([EcoRI]))\n",
"\n",
"seq = Dseq.from_full_sequence_and_overhangs('GAATTC', -1, 0)\n",
"print(seq.get_cutsites([EcoRI]))"
]
},
{
Expand All @@ -144,7 +160,7 @@
"\n",
"## Pairing cutsites\n",
"\n",
"A fragment produced by restriction is represented by a tuple of length two that may contain cutsites or `None`:\n",
"A fragment produced by restriction is represented by a tuple of length 2 that may contain cutsites or `None`:\n",
"\n",
"- Two cutsites: represents the extraction of a fragment between those two cutsites, in that orientation. To represent the opening of a circular molecule with a single cutsite, we put the same cutsite twice. See below.\n",
"- `None`, cutsite: represents the extraction of a fragment between the left edge of linear sequence and the cutsite.\n",
Expand All @@ -157,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -190,8 +206,8 @@
"source": [
"dseq = Dseq('aaGAATTCaaGAATTCaa')\n",
"cutsites = dseq.get_cutsites([EcoRI])\n",
"cutsite_pairs = dseq.get_cutsite_pairs(cutsites)\n",
"\n",
"cutsite_pairs = dseq.get_cutsite_pairs(cutsites)\n",
"pair_types = ['None, cutsite', 'cutsite, cutsite', 'cutsite, None']\n",
"\n",
"for pair, pair_type in zip(cutsite_pairs, pair_types):\n",
Expand All @@ -210,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -228,11 +244,12 @@
}
],
"source": [
"# Note that the cutsite respects the ovhg of the sequence:\n",
"# Note that the cutsite respects the ovhg of the parent sequence:\n",
"dseq = Dseq.from_full_sequence_and_overhangs('aaGAATTCaaGAATTCaa', 1, 1)\n",
"print(dseq.apply_cut(*cutsite_pairs[0]).__repr__())\n",
"f1, f2, f3 = dseq.cut([EcoRI])\n",
"print(f1.__repr__())\n",
"print()\n",
"print(dseq.apply_cut(*cutsite_pairs[-1]).__repr__())\n"
"print(f3.__repr__())\n"
]
}
],
Expand Down

0 comments on commit 9fa5684

Please sign in to comment.