From 6ce5a3fce510cfdbca0d772938c0f91ac1cb8f7d Mon Sep 17 00:00:00 2001 From: BjornFJohansson Date: Sun, 24 Mar 2024 16:32:56 +0000 Subject: [PATCH] user & bugfix amplicon --- src/pydna/amplicon.py | 5 +++-- src/pydna/user_cloning.py | 29 +++++++++++++++++++++++++++++ tests/format_sequences.ipynb | 16 ++++++++-------- tests/test_USERcloning.py | 6 ++++++ tests/test_module_dseq.py | 3 ++- 5 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 src/pydna/user_cloning.py diff --git a/src/pydna/amplicon.py b/src/pydna/amplicon.py index 0e1f1a6c..25e76f53 100755 --- a/src/pydna/amplicon.py +++ b/src/pydna/amplicon.py @@ -119,8 +119,9 @@ def figure(self): faz = tp[fp.position - fp._fp : fp.position].seq raz = tp[rp.position : rp.position + rp._fp].seq sp3 = " " * (len(fp.seq) + 3) - fzc = tp.seq.rc()[::-1][fp.position - fp._fp : fp.position] - rzc = tp.seq.rc()[::-1][rp.position : rp.position + rp._fp] + # breakpoint() + fzc = tp.seq.crick[::-1][fp.position - fp._fp : fp.position] + rzc = tp.seq.crick[::-1][rp.position : rp.position + rp._fp] f = f""" {" " *ft}5{faz}...{raz}3 {sp3}{"|" * rp._fp} diff --git a/src/pydna/user_cloning.py b/src/pydna/user_cloning.py new file mode 100644 index 00000000..1402c65a --- /dev/null +++ b/src/pydna/user_cloning.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2013-2023 by Björn Johansson. All rights reserved. +# This code is part of the Python-dna distribution and governed by its +# license. Please see the LICENSE.txt file that should have been included +# as part of this package. + + +# from abc import ABC, abstractmethod +# import re +# from pydna.utils import rc + + +""" +Nicking & USER cloning + + +CGAuGTCGACTTAGATCTCACAGGCTTTTTTCAAGaCGGCCTTGAATTCAGTCATTTGGATCCGGCCGATC +GCTACAGCTGAATCTAGAGTGTCCGAAAAAAGTTCTGCCGGAACTTAAGTCAGTAAACCTAGGCCGGCuAG + +1. Digest both strands +2. Collect all linear ssDNA +3. Anneal all combinations +4. Keep ones present in original molecule +5. Rank by stability +6. + +""" diff --git a/tests/format_sequences.ipynb b/tests/format_sequences.ipynb index 5915dde1..ebaeb8b4 100755 --- a/tests/format_sequences.ipynb +++ b/tests/format_sequences.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -31,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -200,9 +200,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python [conda env:bjorn38]", + "display_name": "bjorn311", "language": "python", - "name": "conda-env-bjorn38-py" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -214,7 +214,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.11.8" } }, "nbformat": 4, diff --git a/tests/test_USERcloning.py b/tests/test_USERcloning.py index ad389a92..43e88c79 100644 --- a/tests/test_USERcloning.py +++ b/tests/test_USERcloning.py @@ -40,6 +40,12 @@ def test_USER_cloning(): assert p.seq.crick == "GAUCGGCCGGATCCAAATGACTGAATTCAAGGCCGtCTTGAAAAAAGCCTGTGAGATCTAAGTCGACATCG" + + + + + + # hej = p.seq # from Bio.SeqFeature import SeqFeature diff --git a/tests/test_module_dseq.py b/tests/test_module_dseq.py index 376aa0da..315e4aa8 100644 --- a/tests/test_module_dseq.py +++ b/tests/test_module_dseq.py @@ -191,6 +191,7 @@ def cut_and_religate_Dseq(seq_string, enz, top): ] for s in seqs: + print(s) sek, enz, lin = s for i in range(len(sek)): zek = sek[i:] + sek[:i] @@ -591,6 +592,7 @@ def test_Dseq_slicing2(): def test_Dseq___getitem__(): + # test the slicing from pydna.dseq import Dseq s = Dseq("GGATCC", circular=False) @@ -603,7 +605,6 @@ def test_Dseq___getitem__(): assert s[5:1:-1] == Dseq("CCTA") assert t[5:1] == Dseq("CG") - assert s[9:1] == Dseq("") assert t[9:1] == Dseq("")