├── .buildinfo ├── .coveragerc ├── .flake8 ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── publish-docs.yml │ ├── pydna_pypi_build_workflow.yml │ ├── pydna_test_and_coverage_workflow.yml │ └── pydna_test_pypi_build_workflow.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .vscode ├── extensions.json └── settings.json ├── LICENSE.txt ├── MANIFEST.in ├── README.md ├── codecov.yml ├── dependabot.yml ├── docs ├── CHANGELOG.md ├── Makefile ├── README.md ├── _static │ ├── BMC.png │ ├── BMC_resized.png │ ├── BMC_resized_old.png │ ├── assembly_fragment_slide_circular.png │ ├── assembly_fragment_slide_linear.png │ ├── create-fork.png │ ├── custom.css │ ├── favicon.ico │ ├── gel.png │ ├── pydna-web.png │ ├── pydna.png │ ├── pydna.resized.png │ ├── pydna240x240.png │ ├── pydna_512x512.png │ ├── pydna_512x512_trsp.png │ ├── pydna_transparent.png │ └── snake.png ├── autogen_docs.sh ├── colored.png ├── conf.py ├── cookbook │ ├── 2389.fasta │ ├── 2577.fasta │ ├── 5681.fasta │ ├── GUP1_locus.gb │ ├── GUP1rec1sens.txt │ ├── GUP1rec2AS.txt │ ├── XKS1_orf.txt │ ├── YEp24PGK.txt │ ├── YEp24PGK_XK.gb │ ├── YEp24PGK_XK_manually_assembled.txt │ ├── YEp24PGK_XK_vector.gb │ ├── cookbook.ipynb │ ├── figure1.gif │ ├── figure1.odp │ ├── figure1.png │ ├── figure2.png │ ├── logo.png │ ├── pGREG505.gb │ ├── pGREG505.png │ ├── pGUP1.gb │ ├── pGUP1_NEW.gb │ ├── pGUP1_OLD.gb │ ├── pGUP1_vector.gb │ ├── primer1.txt │ ├── primer3.txt │ ├── pydna_cookbook_0-6-0.docx │ ├── pydna_cookbook_0-6-0.odt │ ├── pydna_cookbook_0-6-0.pdf │ └── seqs.fas ├── docs regarding PCR programs for enzymes with sso7 domains │ ├── Finnzymes Reagents - Optimizing Tm and annealing.pdf │ ├── Optimizing Tm and Annealing _ Thermo Fisher Scientific.pdf │ └── PCR Protocol for Phusion High-Fidelity DNA Polymerase (M0530) _ NEB.pdf ├── example.png ├── example_gallery.md ├── example_old.png ├── future_release_names.md ├── getting_started.md ├── index.rst ├── installation.rst ├── make.bat ├── notebooks │ ├── CRISPR.ipynb │ ├── CU329670.gb │ ├── Dseq.ipynb │ ├── Dseq_Features.ipynb │ ├── Example_CRISPR.ipynb │ ├── Example_Gibson.ipynb │ ├── Example_Restriction.ipynb │ ├── Gibson.ipynb │ ├── Importing_Seqs.ipynb │ ├── PCR.ipynb │ ├── Restrict_Ligate_Cloning.ipynb │ ├── U49845.fasta │ ├── U49845.gb │ ├── gibson_eg.gb │ ├── pCC1BAC.gb │ ├── pFA6a-kanMX6.gb │ ├── primer_design.ipynb │ ├── readme_example.ipynb │ └── sample_seq.gb ├── pydna_cheat_sheet.odt ├── pydna_cheat_sheet.pdf └── pydna_session.py ├── gpl.txt ├── objects.inv ├── poetry.lock ├── poetry.toml ├── pyproject.toml ├── requirements.txt ├── run_test.py ├── scripts ├── Add_primers_to_list.ipynb ├── BioJSON-master │ ├── genbank_writer.py │ ├── locus_fixer.ipynb │ ├── new_file.py │ ├── testfile.json │ └── testfiles │ │ ├── ApE_example.gb │ │ ├── NCBI_example.gb │ │ ├── P30350%20(2013-10-11%2013_49_14).dna.txt │ │ ├── VectorNTI_example.gb │ │ ├── YEplac181.txt │ │ ├── hej.txt │ │ ├── na.gb │ │ ├── pGADT7-Rec.gb │ │ └── sequence.gb ├── Cloning - Choice of Expression Systems - The 8 least used codons in E. coli, yeast, Drosophila and primates - EMBL.pdf ├── Deqrecord.ipynb ├── LongestCommonSubstring │ ├── experiments.py │ ├── lcs.py │ ├── lecture9-1.pdf │ ├── minimal_example.py │ ├── suffix_arrays.ipynb │ └── untitled6.py ├── PCR primer parsing │ ├── SynthesisReport_3931076.pdf │ ├── mecplugins_parse_mwg_primers.py │ └── show-order.tcl.html ├── SeqRecord.ipynb ├── Ta │ ├── 19-3-698-t.pdf │ ├── EIF4E_NM_001130679.3.gb │ ├── Lambda_J02459.1.gb │ ├── Rychlik et al. 1990 - Optimization of the annealing temperature for DNA amplification in vitro.pdf │ ├── Ta.py │ ├── TableI.png │ ├── TableII.png │ ├── table1.png │ └── table2.png ├── YEp24PGK_XK │ ├── AF016889.gb │ ├── KC562906.gb │ ├── YEp24PGK_XK.gb │ └── Z72979.gb ├── _simple_paths8.py ├── angularjs_notebook.ipynb ├── ape_test │ ├── ape_test.ape │ └── pMEC1142_dom.ape ├── assembly_figures.txt ├── bandwagon__.ipynb ├── biosubclasses.py ├── cai_test.ipynb ├── check_my_primers.py ├── compare_local_and_gdoc_primer_lists.py ├── conda-build │ ├── meta (copy).yaml │ ├── meta (copy2).yaml │ ├── meta2.yaml │ ├── myenvironment.yaml │ ├── pydna_build_environment (copy).yml │ ├── pydna_build_environment.yml │ └── pydna_mamba_build_workflow.yml ├── cutsite_pairs.ipynb ├── deps.js ├── experimental_gel.py ├── experimental_gel2.py ├── features │ ├── BBa_K523026.gff │ ├── embl.gff │ ├── experimental_feature.py │ └── files_for_annotation_function │ │ ├── genolib_SBOL_files_from_Tim.zip │ │ ├── labhost_All.xml │ │ ├── labhost_Aspergillus_nidulans.xml │ │ ├── labhost_Bacillus_subtilis.xml │ │ ├── labhost_Drosophila_melanogaster.xml │ │ ├── labhost_Escherichia_Coli.xml │ │ ├── labhost_Gram-negative_bacteria.xml │ │ ├── labhost_Insect_Cells.xml │ │ ├── labhost_Kluyveromyces_lactis.xml │ │ ├── labhost_Mammalian_Cells.xml │ │ ├── labhost_Pichia_pastoris.xml │ │ ├── labhost_Plant_Cells.xml │ │ ├── labhost_Saccharomyces_cerevisiae.xml │ │ ├── labhost_Schizosaccharomyces_pombe.xml │ │ ├── labhost_Unspecified.xml │ │ ├── nar-03388-h-2014-File005.pdf │ │ ├── nar-03388-h-2014-File006.pdf │ │ ├── nar-03388-h-2014-File007.pdf │ │ ├── nar-03388-h-2014-File008.cys │ │ ├── nar-03388-h-2014-File009.zip │ │ ├── nar-03388-h-2014-File010.zip │ │ ├── post.md │ │ └── test.py ├── finding_seqs_over_origin.ipynb ├── gb_comment_parsing.ipynb ├── gel │ ├── bandwagon__.py │ ├── gel2.py │ ├── gel3.py │ └── gel_old.py ├── gel_example.ipynb ├── gel_example_invisible_bands.ipynb ├── gel_inline_ex.ipynb ├── guess_alphabet.py ├── gui.py ├── importing notebooks as modules.ipynb ├── importing_nb_as_module.ipynb ├── input_template.ng ├── js.ipynb ├── jupyter_note_book.ipynb ├── log exp │ ├── test.py │ └── test_log.py ├── memo │ ├── _xperimental.py │ ├── download_old.py │ ├── gojs.py │ ├── mem.py │ ├── mem2.py │ ├── memmo.py │ ├── memo01.py │ ├── memo02.py │ ├── meta.py │ └── xperimental.py ├── molecular_weight_standards.ods ├── nbpackage │ ├── __init__.py │ └── mynotebook.ipynb ├── notebooks_convert_all_to_html.py ├── notebooks_run_all.py ├── notebooks_test_all.py ├── old_myprimer_code.py ├── pGUP1-2 │ ├── GUP1_locus.gb │ ├── GUP1rec1sens.txt │ ├── GUP1rec2AS.txt │ ├── id.gb │ ├── jupyternb (copy).ipynb │ ├── jupyternb.ipynb │ ├── name.ape │ ├── pGREG505.gb │ ├── pGUP1.gb │ └── pGUP1_2.gb ├── persistent cache decorator.py ├── predefined_feature_colors.py ├── pydna_gel.png ├── pydna_test │ ├── MySeq2.gb │ ├── MySeq2_copied.gb │ ├── jupyter_note_book.ipynb │ └── python_script.py ├── python pptx example │ ├── python pptx example.py │ └── test.pptx ├── remove_local_and_remote_alpha_git_tags.sh ├── simple_band_patterns.png ├── smallest_rotation │ ├── duval_algorithm │ ├── duval_algorithm.rs │ ├── smallest.c │ ├── smallest.h │ ├── smallest2.cpp │ └── smallest_ext.c ├── speed.py ├── spyder_start.py ├── temp (copy).py ├── temp.py ├── test_primer_id.py ├── tqdm_progress_bar.ipynb └── tracer │ ├── load_reads.ipynb │ └── sequencings │ ├── Order_3504177_Results.zip │ ├── Untitled Folder │ └── test2.scf │ ├── test.ab1 │ ├── test.zip │ └── test2.scf ├── src └── pydna │ ├── __init__.py │ ├── _pretty.py │ ├── _thermodynamic_data.py │ ├── all.py │ ├── amplicon.py │ ├── amplify.py │ ├── assembly.py │ ├── codon.py │ ├── common_sub_strings.py │ ├── conftest.py │ ├── contig.py │ ├── crispr.py │ ├── design.py │ ├── download.py │ ├── dseq.py │ ├── dseqrecord.py │ ├── editor.py │ ├── fakeseq.py │ ├── fusionpcr.py │ ├── gateway.py │ ├── gel.py │ ├── genbank.py │ ├── genbankfile.py │ ├── genbankfixer.py │ ├── genbankrecord.py │ ├── goldengate.py │ ├── ladders.py │ ├── ligate.py │ ├── myenzymes.py │ ├── myprimers.py │ ├── parsers.py │ ├── primer.py │ ├── readers.py │ ├── seq.py │ ├── seqrecord.py │ ├── sequence_picker.py │ ├── threading_timer_decorator_exit.py │ ├── tm.py │ ├── user_cloning.py │ └── utils.py └── tests ├── .coveragerc ├── 02-G1_B01_013.ab1 ├── 1362_6.ape ├── 15405_2.ape ├── 28-1rev_D04_026.ab1 ├── 32-3rev_H04_018.ab1 ├── 36-5rev_D05_041.ab1 ├── 8054_2.ape ├── AAA_OLD.gb ├── ABI01.abi ├── AJ515744.gb ├── AJ515746.gb ├── AJ580803.gb ├── AJ580804.gb ├── AM086621.gb ├── AX023560.gb ├── E05006.gb ├── G.txt ├── GIN11M86.gb ├── GUP1_locus.gb ├── GUP1rec1sens.txt ├── GUP1rec2AS.txt ├── Ggatcc (copy).gb ├── Ggatcc.gb ├── KlLEU2tt.fas ├── KlLEU2tt.gb ├── New_DNA.gb ├── New_DNA__________________.gb ├── RefDataBjorn.fas ├── SYNPUC19CV.gb ├── X06035.ape ├── X60065-100-110.gb ├── X60065.gb ├── XKS1_orf.txt ├── YEp24PGK.txt ├── YEp24PGK_.txt ├── YEp24PGK_XK_manually_assembled.txt ├── YLACC1_locus.gb ├── _.gb ├── ___test_module_myprimers_gdoc.py___ ├── __getenv.txt ├── _test_module_genbank2.py_ ├── broken_genbank_files ├── ApE_example.gb ├── Author sequence.gb ├── NCBI_example.gb ├── P30350%20(2013-10-11%2013_49_14).dna.txt ├── VectorNTI_example.gb ├── YEplac181.txt ├── fakeGenBankFile.gb ├── hej.txt ├── pGADT7-Rec.gb ├── pGreenLantern1.gb └── sequence.gb ├── conftest.py ├── dna2943.gb ├── dna2943_mod.gb ├── example.ipynb ├── figures.odt ├── foo ├── format_sequences.ipynb ├── jupyter_test_repr (copy).ipynb________ ├── jupyter_test_repr.ipynb ├── lambda.gb ├── my_test_enzymes.txt ├── myseq.gb ├── nucleotide1.xml ├── output.file ├── pAG25.gb ├── pAG32.gb ├── pCAPs-AjiI.gb ├── pCAPs-pSU0.gb ├── pCAPs.gb ├── pCAPs_fasta (copy).txt ├── pCAPs_fasta.txt ├── pCAPs_lowgc.gb ├── pCR_MCT1_HA46.gb ├── pGREG505.gb ├── pGSHU 7180bp.gb ├── pGSKU 6961bp.gb ├── pGUP1_correct.gb ├── pGUP1_not_synced.gb ├── pKT127______.ape ├── pMEC1135.gb ├── pMX4blaster2_old.gb ├── pUC19-BamHI-a-rc.gb ├── pUC19-BamHI-a.gb ├── pUC19-EcoRI_PstI-d-rc.gb ├── pUC19-SmaI-a.gb ├── pUC19.gb ├── pUC19_M77789.gb ├── pUC19_MarkBudde.gb ├── pUC19_fasta.txt ├── pUC19_small_gene.gb ├── pUC_LAC4.gb ├── pUC_LAC4_correct_rotation.gb ├── pYPK0_TDH3_GAL2_PGI1.gb ├── pYPKa.gb ├── pYPKp7.gb ├── primer1.txt ├── primer3.txt ├── primers.fas ├── primers_linux_line_endings.txt ├── primers_linux_line_endings_not_unique.txt ├── profile.pstat ├── pth1.txt ├── pth2.txt ├── pthx.txt ├── pydna_gel.png ├── pydna_gel2.png ├── pydna_read_test.txt ├── pydna_read_test2.txt ├── pydna_read_test3.txt ├── read1.gb ├── read2.gb ├── read3.fasta ├── read4.fasta ├── run_assembly_tests.sh ├── run_pytest_with_coverage.sh ├── save_changed_seq.ipynb ├── sequence.gb ├── subfolder └── sequence.gb ├── test ├── test_USERcloning.py ├── test_extra_cut_features.py ├── test_extra_markbudde.py ├── test_extra_santirdnd_bug_spanning_features.py ├── test_longerlocus_name_gives_dseq.py ├── test_module___init__.py ├── test_module__pretty.py ├── test_module__thermodynamic_data.py ├── test_module_all.py ├── test_module_amplicon.py ├── test_module_amplify.py ├── test_module_assembly.py ├── test_module_common_sub_strings.py ├── test_module_contig.py ├── test_module_crispr.py ├── test_module_design.py ├── test_module_download.py ├── test_module_dseq.py ├── test_module_dseqrecord.py ├── test_module_editor.py ├── test_module_fakeseq.py ├── test_module_fusionpcr.py ├── test_module_gel.py ├── test_module_genbank.py ├── test_module_genbankfile.py ├── test_module_genbankfixer.py ├── test_module_genbankrecord.py ├── test_module_ligate.py ├── test_module_myenzymes.py ├── test_module_myprimers.py ├── test_module_parsers.py ├── test_module_primer.py ├── test_module_readers.py ├── test_module_seq.py ├── test_module_seqrecord.py ├── test_module_tm.py └── test_module_utils.py /.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: e1ad02ce3592def18a437f1884177507 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = pydna 4 | omit = 5 | */tests/* 6 | */_version.py 7 | src/pydna/threading_timer_decorator_exit.py 8 | 9 | [report] 10 | exclude_lines = 11 | pragma: no cover 12 | if __name__==.__main__.: 13 | if __name__ ==.__main__.: 14 | if __name__== .__main__.: 15 | if __name__ == .__main__.: 16 | ignore_errors = True 17 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = E203, E266, E501, W503, F403, E741, B905 3 | max-line-length = 119 4 | max-complexity = 18 5 | select = B,C,E,F,W,T4,B9 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | pydna/_version.py export-subst 2 | .git_archival.json export-subst 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "pip" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | target-branch: "dev_bjorn" 13 | -------------------------------------------------------------------------------- /.github/workflows/publish-docs.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | name: "Documentation Status" 4 | 5 | permissions: 6 | contents: write 7 | 8 | jobs: 9 | build-and-publish: 10 | if: "! contains(github.event.head_commit.message, '[ci skip]')" 11 | 12 | timeout-minutes: 10 13 | 14 | runs-on: ubuntu-latest 15 | 16 | strategy: 17 | fail-fast: false 18 | 19 | steps: 20 | - uses: actions/checkout@v4 21 | 22 | - name: Set up Python 23 | uses: actions/setup-python@v4 24 | 25 | - name: Session information 26 | run: | 27 | python --version 28 | 29 | - name: Install Poetry 30 | uses: snok/install-poetry@v1 31 | with: 32 | virtualenvs.prefer-active-python: true 33 | 34 | - name: 🔩 list Poetry settings 35 | run: poetry config --list 36 | 37 | - name: 🔩 Install with Poetry 38 | run: poetry install --all-extras --with docs 39 | 40 | - name: Build documentation 41 | run: | 42 | cd docs 43 | poetry run bash autogen_docs.sh 44 | poetry run make html 45 | 46 | - name: Deploy to GitHub pages 🚀 47 | # Deploy only when master changes 48 | if: github.ref == 'refs/heads/master' && github.event_name == 'push' 49 | uses: JamesIves/github-pages-deploy-action@v4.6.0 50 | with: 51 | clean: false 52 | branch: gh-pages 53 | folder: docs/_build/html 54 | -------------------------------------------------------------------------------- /.github/workflows/pydna_pypi_build_workflow.yml: -------------------------------------------------------------------------------- 1 | name: Build for PyPI 2 | on: 3 | release: 4 | types: [published] 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | if: github.event.release.target_commitish == 'master' 9 | steps: 10 | - uses: actions/checkout@v3 11 | - name: Build and publish to pypi 12 | uses: JRubics/poetry-publish@v1.16 13 | with: 14 | pypi_token: ${{ secrets.PYPI_TOKEN }} 15 | plugins: "poetry-dynamic-versioning[plugin]" 16 | -------------------------------------------------------------------------------- /.github/workflows/pydna_test_pypi_build_workflow.yml: -------------------------------------------------------------------------------- 1 | name: Build for TESTPyPI 2 | on: 3 | release: 4 | types: [published] 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | if: github.event.release.target_commitish == 'testpypi' 9 | steps: 10 | - uses: actions/checkout@v3 11 | - name: Build and publish to pypi 12 | uses: JRubics/poetry-publish@v1.16 13 | with: 14 | pypi_token: ${{ secrets.TEST_PYPI_TOKEN }} 15 | repository_name: "testpypi" 16 | repository_url: "https://test.pypi.org/legacy/" 17 | plugins: "poetry-dynamic-versioning[plugin]" 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .python-version 2 | 3 | .virtual_documents 4 | 5 | /prof/ 6 | /tests/prof/ 7 | 8 | src/pydna/_version.py* 9 | 10 | .pytest_cache 11 | 12 | # Backup files 13 | *~ 14 | 15 | *.ipynb_checkpoints 16 | 17 | # Byte-compiled / optimized / DLL files 18 | __pycache__/ 19 | *.py[cod] 20 | 21 | # C extensions 22 | *.so 23 | 24 | # Distribution / packaging 25 | .Python 26 | conda/ 27 | env/ 28 | build/ 29 | develop-eggs/ 30 | dist/ 31 | downloads/ 32 | eggs/ 33 | lib/ 34 | lib64/ 35 | parts/ 36 | sdist/ 37 | var/ 38 | *.egg-info/ 39 | .installed.cfg 40 | *.egg 41 | .venv/ 42 | 43 | # PyInstaller 44 | # Usually these files are written by a python script from a template 45 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 46 | *.manifest 47 | *.spec 48 | 49 | # Installer logs 50 | pip-log.txt 51 | pip-delete-this-directory.txt 52 | 53 | # Unit test / coverage reports 54 | htmlcov/ 55 | .tox/ 56 | .coverage 57 | .coverage.* 58 | .cache 59 | nosetests.xml 60 | coverage.xml 61 | 62 | # Translations 63 | *.mo 64 | *.pot 65 | 66 | # Django stuff: 67 | *.log 68 | 69 | # Sphinx documentation 70 | docs/_build/ 71 | docs/markdown_notebooks 72 | docs/modules/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | .eggs 78 | 79 | # mac files 80 | .DS_Store 81 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.5.0 4 | hooks: 5 | # Prevent committing to the master branch 6 | - id: no-commit-to-branch 7 | args: [--branch, master] 8 | # Format yaml files 9 | - id: check-yaml 10 | # Ignore conda build meta.yaml files 11 | exclude: ^scripts/conda-build/meta.*\.yaml$ 12 | # Fix end-of-file issues 13 | - id: end-of-file-fixer 14 | # Fix trailing whitespace 15 | - id: trailing-whitespace 16 | # Prevent debug statements 17 | - id: debug-statements 18 | - id: fix-encoding-pragma 19 | - id: mixed-line-ending 20 | # Code formatting 21 | - repo: https://github.com/ambv/black 22 | rev: 24.2.0 23 | hooks: 24 | - id: black 25 | # Further linting (e.g. module imported but not used) 26 | - repo: https://github.com/PyCQA/flake8 27 | rev: 7.0.0 28 | hooks: 29 | - id: flake8 30 | # Verify that requirements.txt is up to date with poetry dependencies every commit 31 | - repo: https://github.com/python-poetry/poetry 32 | rev: 1.8.3 33 | hooks: 34 | - id: poetry-export 35 | args: [ 36 | "-f", 37 | "requirements.txt", 38 | "--output", 39 | "requirements.txt", 40 | "--with", 41 | "dev", 42 | "--with", 43 | "test", 44 | "--with", 45 | "docs", 46 | "-E", 47 | "clipboard download express gel", 48 | ] 49 | files: 'requirements.txt' 50 | # Remove metadata from jupyter notebooks. This will always be triggered when you commit a change in a notebook. 51 | # Simply do `git add` and commit again. 52 | - repo: local 53 | hooks: 54 | - id: nbstripout 55 | name: nbstripout with keep-output 56 | entry: | 57 | python -m nbstripout --keep-output $@ 58 | language: system 59 | files: \.ipynb$ 60 | exclude: tests/ 61 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.black-formatter", 4 | "ms-python.flake8", 5 | "ms-python.python", 6 | "ms-python.vscode-pylance", 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": true, 4 | "**/.svn": true, 5 | "**/.hg": true, 6 | "**/CVS": true, 7 | "**/.DS_Store": true, 8 | "**/*.pyc": true, 9 | "**/__pycache__": true 10 | }, 11 | // Set flake8 path 12 | "flake8.path": [".venv/bin/flake8"], 13 | "black-formatter.path": [".venv/bin/black"], 14 | "python.defaultInterpreterPath": ".venv/bin/python", 15 | } 16 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # MANIFEST.in 2 | # This tells distutils what files to distribute. 3 | graft src 4 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | 4 | coverage: 5 | precision: 2 6 | round: down 7 | range: "70...100" 8 | 9 | parsers: 10 | gcov: 11 | branch_detection: 12 | conditional: yes 13 | loop: yes 14 | method: no 15 | macro: no 16 | 17 | comment: 18 | layout: "reach,diff,flags,tree" 19 | behavior: default 20 | require_changes: no 21 | -------------------------------------------------------------------------------- /dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "python" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "monthly" 12 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/_static/BMC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/BMC.png -------------------------------------------------------------------------------- /docs/_static/BMC_resized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/BMC_resized.png -------------------------------------------------------------------------------- /docs/_static/BMC_resized_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/BMC_resized_old.png -------------------------------------------------------------------------------- /docs/_static/assembly_fragment_slide_circular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/assembly_fragment_slide_circular.png -------------------------------------------------------------------------------- /docs/_static/assembly_fragment_slide_linear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/assembly_fragment_slide_linear.png -------------------------------------------------------------------------------- /docs/_static/create-fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/create-fork.png -------------------------------------------------------------------------------- /docs/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* Make output cells that are too long scrollable */ 2 | .highlight-none { 3 | position: relative; 4 | margin-top: 20px; 5 | } 6 | 7 | /* Add a label to the top of the output cell */ 8 | .highlight-none::before { 9 | content: "output"; 10 | position: absolute; 11 | top: 0px; 12 | left: 0; 13 | background-color: #f0f0f0; 14 | color: #333; 15 | padding: 2px 8px; 16 | font-size: 12px; 17 | border-radius: 3px 3px 0 0; 18 | z-index: 1; 19 | } 20 | 21 | div.highlight-none pre { 22 | max-height: 300px; 23 | overflow-y: auto; 24 | } 25 | 26 | /* Add same label to highlight-python cells */ 27 | .highlight-python { 28 | position: relative; 29 | } 30 | 31 | /* Add a label to the top of the output cell */ 32 | .highlight-python::before { 33 | content: "python code"; 34 | position: absolute; 35 | top: 0px; 36 | left: 0; 37 | background-color: #f0f0f0; 38 | color: #333; 39 | padding: 2px 8px; 40 | font-size: 12px; 41 | border-radius: 3px 3px 0 0; 42 | z-index: 1; 43 | } 44 | 45 | /* Add padding to the top to fit the label */ 46 | .rst-content div[class^="highlight"] pre { 47 | padding-top: 25px; 48 | } 49 | -------------------------------------------------------------------------------- /docs/_static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/favicon.ico -------------------------------------------------------------------------------- /docs/_static/gel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/gel.png -------------------------------------------------------------------------------- /docs/_static/pydna-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna-web.png -------------------------------------------------------------------------------- /docs/_static/pydna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna.png -------------------------------------------------------------------------------- /docs/_static/pydna.resized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna.resized.png -------------------------------------------------------------------------------- /docs/_static/pydna240x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna240x240.png -------------------------------------------------------------------------------- /docs/_static/pydna_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna_512x512.png -------------------------------------------------------------------------------- /docs/_static/pydna_512x512_trsp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna_512x512_trsp.png -------------------------------------------------------------------------------- /docs/_static/pydna_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/pydna_transparent.png -------------------------------------------------------------------------------- /docs/_static/snake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/_static/snake.png -------------------------------------------------------------------------------- /docs/autogen_docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit on error 4 | set -e 5 | 6 | # Loop through all notebooks in the markdown_notebooks directory 7 | for notebook in notebooks/*.ipynb; do 8 | # Convert each notebook to markdown 9 | python -m nbconvert $notebook --to markdown --output-dir markdown_notebooks 10 | done 11 | 12 | # Get module names 13 | all_modules=$(python -c "import pydna; import pkgutil; [print(name) for _, name, _ in pkgutil.iter_modules(pydna.__path__)]") 14 | 15 | # If the modules folder does not exist, create it 16 | mkdir -p modules 17 | 18 | # Create the root pydna.rst file 19 | echo "Creating pydna.rst" 20 | echo "pydna" > modules/pydna.rst 21 | echo "=====" >> modules/pydna.rst 22 | echo "" >> modules/pydna.rst 23 | echo ".. automodule:: pydna" >> modules/pydna.rst 24 | echo " :members:" >> modules/pydna.rst 25 | echo " :undoc-members:" >> modules/pydna.rst 26 | echo " :show-inheritance:" >> modules/pydna.rst 27 | 28 | # Create the modules/index.rst file 29 | echo "Creating modules/index.rst" 30 | echo "Modules" > modules/index.rst 31 | echo "=======" >> modules/index.rst 32 | echo "" >> modules/index.rst 33 | echo ".. toctree::" >> modules/index.rst 34 | echo " :maxdepth: 1" >> modules/index.rst 35 | echo " :caption: Modules:" >> modules/index.rst 36 | echo "" >> modules/index.rst 37 | echo " pydna" >> modules/index.rst 38 | 39 | # For each module create a rst file in ./modules 40 | for module in $all_modules; do 41 | echo "Creating pydna_$module.rst" 42 | echo "pydna.$module" > modules/pydna_$module.rst 43 | echo "==========" >> modules/pydna_$module.rst 44 | echo "" >> modules/pydna_$module.rst 45 | echo ".. automodule:: pydna.$module" >> modules/pydna_$module.rst 46 | echo " :members:" >> modules/pydna_$module.rst 47 | echo " :undoc-members:" >> modules/pydna_$module.rst 48 | echo " :show-inheritance:" >> modules/pydna_$module.rst 49 | 50 | # Add the module to the modules/index.rst file 51 | echo " pydna_$module" >> modules/index.rst 52 | done 53 | -------------------------------------------------------------------------------- /docs/colored.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/colored.png -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Configuration file for the Sphinx documentation builder. 3 | # 4 | # For the full list of built-in configuration values, see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Project information ----------------------------------------------------- 8 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 9 | 10 | import os 11 | import sys 12 | from importlib.metadata import version 13 | 14 | project = "pydna" 15 | copyright = "2024, Björn F. Johansson" 16 | author = "Björn F. Johansson" 17 | 18 | sys.path.insert(0, os.path.abspath("../src/pydna")) 19 | # contents of docs/conf.py 20 | 21 | release = version("pydna") 22 | # for example take major/minor 23 | version = ".".join(release.split(".")[:3]) 24 | 25 | # -- General configuration --------------------------------------------------- 26 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 27 | 28 | extensions = [ 29 | "sphinx.ext.autodoc", 30 | "sphinx.ext.coverage", 31 | "sphinx.ext.napoleon", 32 | "sphinx.ext.doctest", 33 | "myst_parser", # Allows to use markdown files instead of rst 34 | "sphinx.ext.viewcode", 35 | "sphinx.ext.autosummary", 36 | "numpydoc", 37 | "sphinx.ext.intersphinx", 38 | "sphinx_rtd_theme", 39 | ] 40 | 41 | # Add mappings https://kev.inburke.com/kevin/sphinx-interlinks 42 | intersphinx_mapping = { 43 | "biopython": ("https://biopython.org/docs/latest/api/", None), 44 | "python": ("http://docs.python.org/3.8", None), 45 | } 46 | 47 | # Settings to support markdown files 48 | source_suffix = { 49 | ".rst": "restructuredtext", 50 | ".md": "markdown", 51 | } 52 | 53 | templates_path = ["_templates"] 54 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 55 | 56 | autodoc_member_order = "bysource" 57 | autodoc_preserve_defaults = True 58 | 59 | numpydoc_show_class_members = False 60 | 61 | # -- Options for HTML output ------------------------------------------------- 62 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 63 | 64 | html_theme = "sphinx_rtd_theme" 65 | html_static_path = ["_static"] 66 | 67 | texinfo_documents = [ 68 | ( 69 | "index", 70 | "Pydna", 71 | "Pydna Documentation", 72 | "Björn Johansson", 73 | "Pydna", 74 | "One line description of project.", 75 | "Miscellaneous", 76 | ), 77 | ] 78 | 79 | # Add custom css 80 | html_css_files = [ 81 | "custom.css", 82 | ] 83 | 84 | html_favicon = "_static/favicon.ico" 85 | -------------------------------------------------------------------------------- /docs/cookbook/2389.fasta: -------------------------------------------------------------------------------- 1 | >2389 2 | ctgtgaagtggctgaaatttcgtacaaaaaatttcgccaattgattcaggtaaatccggatgctggaacaaaagtgatctatatcatagattcatcattttattttcttgctagagtgcataccaaatctttatctggtttctcaatttacatgatctcccgttataactcggggaactactaccgtatatactttgttcctcgatttcaaagtacaatcataatctcatctgacttatcgttttttcttttatctttctcttcatctcaatattatgattagattgttttgtaagcttttctacctgaaatatgcaccaatattcagaatatctcgtttgccagtttttatacaagtctttctatagttaagtataaaaatgttatgttattaacgttcaaatgctcaatcacatctggacaagcaaatttccttgtcttcagttcattttgggtatgctcctttagatttaacacattgcaggctaaccggaacctgtattatttagtttatgctacgttaaataaagacctttcgttcacataactgaatgtgtaatggccttgagatttcaagcataccaagttggtggagacggggtcgttacaaaagactctatcctgatgcgtttgtctgcacagatggcactccgattaccctgttatccctacaagaatctttttattgtcagtactgattattcctttgccctcggacgagtgctggggcgtcggtttccactatcggcgagtacttctacacagccatcggtccagacggccgcgcttctgcgggcgatttgtgtacgcccgacagtcccggctccggatcggacgattgcgtcgcatcgaccctgcgcccaagctgcatcatcgaaattgccgtcaaccaagctctgatagagttggtcaagaccaatgcggagcatatacgcccggagccgcggcgatcctgcaagctccggatgcctccgctcgaagtagcgcgtctgctgctccatacaagccaaccacggcctccagaagaagatgttggcgacctcgtattgggaatccccgaacatcgcctcgctccagtcaatgaccgctgttatgcggccattgtccgtcaggacattgttggagccgaaatccgcgtgcacgaggtgccggacttcggggcagtcctcggcccaaagcatcagctcatcgagagcctgcgcgacggacgcactgacggtgtcgtccatcacagtttgccagtgatacacatggggatcagcaatcgcgcatatgaaatcacgccatgtagtgtattgaccgattccttgcggtccgaatgggccgaacccgctcgtctggctaagatcggccgcagcgatcgcatccatggcctccgcgaccggctgcagaacagcgggcagttcggtttcaggcaggtcttgcaacgtgacaccctgtgcacggcgggagatgcaataggtcaggctctcgctgaattccccaatgtcaagcacttccggaatcgggagcgcggccgatgcaaagtgccgataaacataacgatctttgtagaaaccatcggcgcagctatttacccgcaggacatatccacgccctcctacatcgaagctgaaagcacgagattcttcgccctccgagagctgcatcaggtcggagacgctgtcgaacttttcgatcagaaacttctcgacagacgtcgcggtgagttcaggctttttacccatggttgtttatgttcggatgtgatgtgattgggtcggctgcaggtcactagtgagaaagtgggcaacctggcgttcctcgacggttgtttatgttcggatgtgatgtgagaactgtatcctagcaagattttaaaaggaagtatatgaaagaagaacctcagtggcaaatcctaaccttttatatttctctacaggggcgcggcgtggggacaattcaacgcgtctgtgaggggagcgtttccctgctcgcaggtctgcagcgaggagccgtaatttttgcttcgcgccgtgcggccatcaaaatgtatggatgcaaatgattatacatggggatgtatgggctaaatgtacgggcgacagtcacatcatgcccctgagctgcgcacgtcaagactgtcaaggagggtattctgggcctccatgtcgctggccgggtgacccggcggggacaaggcaagctaaacagatctggcgcgccttaattaacccggggatccgtcgacctgcagcgtacgaagcttcagctggcggccgcgttctatagtgtcacctaaatcgtatgtggtcagcggccgcattgcacagactctgctgaatctggcaaaacaaccagacgctatgactcacccggacggcatgcaaatcaaaattacccgtcagga 3 | -------------------------------------------------------------------------------- /docs/cookbook/2577.fasta: -------------------------------------------------------------------------------- 1 | >2577 2 | tcctgacgggtaattttgatttgcatgccgtccgggtgagtcatagcgtctggttgttttgccagattcagcagagtctgtgcaatgcggccgctgacagagtcttttgtaacgaccccgtctccaccaacttggtatgcttgaaatctcaaggccattacacattcagttatgtgaacgaaaggtctttatttaacgtagcataaactaaataatacaggttccggttagcctgcaatgtgttaaatctaaaggagcatacccaaaatgaactgaagacaaggaaatttgcttgtccagatgtgattgagcatttgaacgttaataacataacatttttatacttaactatagaaagacttgtataaaaactggcaaacgagatattctgaatattggtgcatatttcaggtagaaaagcttacaaaacaatctaatcataatattgagatgaagagaaagataaaagaaaaaacgataagtcagatgagattatgattgtactttgaaatcgaggaacaaagtatatacggtagtagttccccgagttataacgggagatcatgtaaattgagaaaccagataaagatttggtatgcactctagcaagaaaataaaatgatgaatctatgatatagatcacttttgttccagcgtcgaggaacgccaggttgcccactttctcactagtgacctgcagccgacgatcagatctttcaggaaagtttcggaggagatagtgttcggcagtttgtacatcatctgcgggatcaggtacggtttgatcaggttgtagaagatcaggtaagacatagaatcgatgtagatgatcggtttgtttttgttgatttttacgtaacagttcagttggaatttgttacgcagacccttaaccaggtattctacttcttcgaaagtgaaagactgggtgttcagtacgatcgatttgttggtagagtttttgttgtaatcccatttaccaccatcatccatgaaccagtatgccagagacatcggggtcaggtagttttcaaccaggttgttcgggatggtttttttgttgttaacgatgaacaggttagccagtttgttgaaagcttggtgtttgaaagtctgggcgccccaggtgattaccaggttacccaggtggttaacacgttcttttttgtgcggcggggacagtacccactgatcgtacagcagacatacgtggtccatgtatgctttgtttttccactcgaactgcatacagtaggttttaccttcatcacgagaacggatgtaagcatcacccaggatcagaccgatacctgcttcgaactgttcgatgttcagttcgatcagctgggatttgtattctttcagcagtttagagttcggacccaggttcattacctggttttttttgatgtttttcatatgcatggatccggggttttttctccttgacgttaaagtatagaggtatattaacaattttttgttgatacttttattacatttgaataagaagtaatacaaaccgaaaatgttgaaagtattagttaaagtggttatgcagtttttgcatttatatatctgttaatagatcaaaaatcatcgcttcgctgattaattaccccagaaataaggctaaaaaactaatcgcattatcatcctatggttgttaatttgattcgttcatttgaaggtttgtggggccaggttactgccaatttttcctcttcataaccataaaagctagtattgtagaatctttattgttcggagcagtgcggcgcgaggcacatctgcgtttcaggaacgcgaccggtgaagacgaggacgcacggaggagagtcttccttcggagggctgtcacccgctcggcggcttctaatccgtacttcaatatagcaatgagcagttaagcgtattactgaaagttccaaagagaaggtttttttaggctaagataatggggctctttacatttccacaacatataagtaagattagatatggatatgtatatggatatgtatatggtggtaatgccatgtaatatgattattaaacttctttgcgtccatccaacgagatctggcgcgccttaattaacccaacctgcattaatgaatcggccaacgcgcggattaccctgttatccctacatattgttgtgccatctgtgcagacaaacgcatcaggattcagtactgacaataaaaagattcttgttttcaagaacttgtcatttgtatagtttttttatattgtagttgttctattttaatcaaatgttagcgtgatttatattttttttcgcctcgacatcatctgcccagatgcgaagttaagtgcgcagaaagtaatatcatgcgtcaatcgtatgtgaatgctggtcgctatactgctgtcgattcgatactaacgccgccatccagtgtcgaaaacgagctcgaattcatcgatgatatcagatccactagtggcctatgcggccgcggatctgccggtctccctatagtgagtcgatccggatttacctgaatcaattggcgaaattttttgtacgaaatttcagccacttcacag 3 | -------------------------------------------------------------------------------- /docs/cookbook/GUP1rec1sens.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec1sens 2 | gaattcgatatcaagcttatcgataccgatgtcgctgatcagcatcctgtc 3 | -------------------------------------------------------------------------------- /docs/cookbook/GUP1rec2AS.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec2AS 2 | gacataactaattacatgactcgaggtcgactcagcattttaggtaaattccg 3 | -------------------------------------------------------------------------------- /docs/cookbook/XKS1_orf.txt: -------------------------------------------------------------------------------- 1 | >YGR194C Chr 7 2 | ATGTTGTGTTCAGTAATTCAGAGACAGACAAGAGAGGTTTCCAACACAATGTCTTTAGAC 3 | TCATACTATCTTGGGTTTGATCTTTCGACCCAACAACTGAAATGTCTCGCCATTAACCAG 4 | GACCTAAAAATTGTCCATTCAGAAACAGTGGAATTTGAAAAGGATCTTCCGCATTATCAC 5 | ACAAAGAAGGGTGTCTATATACACGGCGACACTATCGAATGTCCCGTAGCCATGTGGTTA 6 | GAGGCTCTAGATCTGGTTCTCTCGAAATATCGCGAGGCTAAATTTCCATTGAACAAAGTT 7 | ATGGCCGTCTCAGGGTCCTGCCAGCAGCACGGGTCTGTCTACTGGTCCTCCCAAGCCGAA 8 | TCTCTGTTAGAGCAATTGAATAAGAAACCGGAAAAAGATTTATTGCACTACGTGAGCTCT 9 | GTAGCATTTGCAAGGCAAACCGCCCCCAATTGGCAAGACCACAGTACTGCAAAGCAATGT 10 | CAAGAGTTTGAAGAGTGCATAGGTGGGCCTGAAAAAATGGCTCAATTAACAGGGTCCAGA 11 | GCCCATTTTAGATTTACTGGTCCTCAAATTCTGAAAATTGCACAATTAGAACCAGAAGCT 12 | TACGAAAAAACAAAGACCATTTCTTTAGTGTCTAATTTTTTGACTTCTATCTTAGTGGGC 13 | CATCTTGTTGAATTAGAGGAGGCAGATGCCTGTGGTATGAACCTTTATGATATACGTGAA 14 | AGAAAATTCAGTGATGAGCTACTACATCTAATTGATAGTTCTTCTAAGGATAAAACTATC 15 | AGACAAAAATTAATGAGAGCACCCATGAAAAATTTGATAGCGGGTACCATCTGTAAATAT 16 | TTTATTGAGAAGTACGGTTTCAATACAAACTGCAAGGTCTCTCCCATGACTGGGGATAAT 17 | TTAGCCACTATATGTTCTTTACCCCTGCGGAAGAATGACGTTCTCGTTTCCCTAGGAACA 18 | AGTACTACAGTTCTTCTGGTCACCGATAAGTATCACCCCTCTCCGAACTATCATCTTTTC 19 | ATTCATCCAACTCTGCCAAACCATTATATGGGTATGATTTGTTATTGTAATGGTTCTTTG 20 | GCAAGGGAGAGGATAAGAGACGAGTTAAACAAAGAACGGGAAAATAATTATGAGAAGACT 21 | AACGATTGGACTCTTTTTAATCAAGCTGTGCTAGATGACTCAGAAAGTAGTGAAAATGAA 22 | TTAGGTGTATATTTTCCTCTGGGGGAGATCGTTCCTAGCGTAAAAGCCATAAACAAAAGG 23 | GTTATCTTCAATCCAAAAACGGGTATGATTGAAAGAGAGGTGGCCAAGTTCAAAGACAAG 24 | AGGCACGATGCCAAAAATATTGTAGAATCACAGGCTTTAAGTTGCAGGGTAAGAATATCT 25 | CCCCTGCTTTCGGATTCAAACGCAAGCTCACAACAGAGACTGAACGAAGATACAATCGTG 26 | AAGTTTGATTACGATGAATCTCCGCTGCGGGACTACCTAAATAAAAGGCCAGAAAGGACT 27 | TTTTTTGTAGGTGGGGCTTCTAAAAACGATGCTATTGTGAAGAAGTTTGCTCAAGTCATT 28 | GGTGCTACAAAGGGTAATTTTAGGCTAGAAACACCAAACTCATGTGCCCTTGGTGGTTGT 29 | TATAAGGCCATGTGGTCATTGTTATATGACTCTAATAAAATTGCAGTTCCTTTTGATAAA 30 | TTTCTGAATGACAATTTTCCATGGCATGTAATGGAAAGCATATCCGATGTGGATAATGAA 31 | AATTGGGATCGCTATAATTCCAAGATTGTCCCCTTAAGCGAACTGGAAAAGACTCTCATC 32 | TAA 33 | -------------------------------------------------------------------------------- /docs/cookbook/figure1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/figure1.gif -------------------------------------------------------------------------------- /docs/cookbook/figure1.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/figure1.odp -------------------------------------------------------------------------------- /docs/cookbook/figure1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/figure1.png -------------------------------------------------------------------------------- /docs/cookbook/figure2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/figure2.png -------------------------------------------------------------------------------- /docs/cookbook/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/logo.png -------------------------------------------------------------------------------- /docs/cookbook/pGREG505.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/pGREG505.png -------------------------------------------------------------------------------- /docs/cookbook/primer1.txt: -------------------------------------------------------------------------------- 1 | >primer1 2 | GCGGATCCTCTAGAATGGTTTGTTCAGTAATTCAG 3 | -------------------------------------------------------------------------------- /docs/cookbook/primer3.txt: -------------------------------------------------------------------------------- 1 | >primer3 2 | AGATCTGGATCCTTAGATGAGAGTCTTTTCCAG 3 | -------------------------------------------------------------------------------- /docs/cookbook/pydna_cookbook_0-6-0.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/pydna_cookbook_0-6-0.docx -------------------------------------------------------------------------------- /docs/cookbook/pydna_cookbook_0-6-0.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/pydna_cookbook_0-6-0.odt -------------------------------------------------------------------------------- /docs/cookbook/pydna_cookbook_0-6-0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/cookbook/pydna_cookbook_0-6-0.pdf -------------------------------------------------------------------------------- /docs/docs regarding PCR programs for enzymes with sso7 domains/Finnzymes Reagents - Optimizing Tm and annealing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/docs regarding PCR programs for enzymes with sso7 domains/Finnzymes Reagents - Optimizing Tm and annealing.pdf -------------------------------------------------------------------------------- /docs/docs regarding PCR programs for enzymes with sso7 domains/Optimizing Tm and Annealing _ Thermo Fisher Scientific.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/docs regarding PCR programs for enzymes with sso7 domains/Optimizing Tm and Annealing _ Thermo Fisher Scientific.pdf -------------------------------------------------------------------------------- /docs/docs regarding PCR programs for enzymes with sso7 domains/PCR Protocol for Phusion High-Fidelity DNA Polymerase (M0530) _ NEB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/docs regarding PCR programs for enzymes with sso7 domains/PCR Protocol for Phusion High-Fidelity DNA Polymerase (M0530) _ NEB.pdf -------------------------------------------------------------------------------- /docs/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/example.png -------------------------------------------------------------------------------- /docs/example_gallery.md: -------------------------------------------------------------------------------- 1 | # Example gallery 2 | 3 | Below are some examples that show the functionality of pydna in real-world scenarios. 4 | 5 | * [Example_Restriction](./markdown_notebooks/Example_Restriction.md): PCRing a gene out of the genome, and cloning into a vector using restriction and ligation. 6 | * [Example_Gibson](./markdown_notebooks/Example_Gibson.md): Gibson assembly of _R. cellulolyticum_ genomic fragments into a plasmid, from the original Gibson assembly paper [doi: 10.1038/nmeth.1318](https://www.nature.com/articles/nmeth.1318). 7 | * [Example_CRISPR](./markdown_notebooks/Example_CRISPR.md): Using CRISPR with homologous recombination to delete genes by making two cuts in the genome, and repair it with an oligo. Used in the industrially relevant _K. phaffi_. 8 | -------------------------------------------------------------------------------- /docs/example_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/example_old.png -------------------------------------------------------------------------------- /docs/getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting started 2 | 3 | 4 | The best way to get started is to follow our tutorial notebooks, you can find them in the 5 | repository folder [docs/notebooks](https://github.com/pydna-group/pydna/tree/master/docs/notebooks) and 6 | are reproduced here so they can serve as documentation. 7 | 8 | You can run the notebooks locally, but also on the browser using Google Colab, simply click in the badge of 9 | the notebook to open it in Colab. 10 | 11 | We recommend that you first go through the following notebooks, which cover the basics of how sequences are handled in pydna: 12 | 13 | 1. [Dseq](./markdown_notebooks/Dseq.md): Basic introduction to how sequences are handled in pydna. 14 | 2. [Dseq_Features](./markdown_notebooks/Dseq_Features.md): How to work with sequence features, which are often present in genbank or dna files to mark regions of interest (coding sequences, resistance markers, etc.) 15 | 3. [Importing_Seqs](./markdown_notebooks/Importing_Seqs.md): How to import sequences from various sources. 16 | 17 | Next, you can learn how specific cloning techniques are handled. 18 | 19 | * [Restrict_Ligate_Cloning](./markdown_notebooks/Restrict_Ligate_Cloning.md): How to perform restriction and ligation. 20 | * [PCR](./markdown_notebooks/PCR.md): How to perform PCR. 21 | * [primer_design](./markdown_notebooks/primer_design.md): How to design primers for Gibson assembly and restriction-ligation cloning. 22 | * [Gibson](./markdown_notebooks/Gibson.md): How to perform Gibson assembly. 23 | * [CRISPR](./markdown_notebooks/CRISPR.md): How to perform CRISPR-Cas9 cutting. 24 | 25 | These notebooks cover the basics, but you can see real-world examples in the [example gallery](./example_gallery.md). 26 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Pydna 2 | ====== 3 | 4 | 5 | Welcome to pydna's documentation! 6 | --------------------------------- 7 | 8 | .. include:: ../README.md 9 | :parser: myst_parser.sphinx_ 10 | :start-after: 11 | :end-before: 12 | 13 | 14 | .. toctree:: 15 | :caption: Contents: 16 | :maxdepth: 1 17 | :hidden: 18 | 19 | self 20 | installation 21 | modules/index 22 | getting_started 23 | example_gallery 24 | 25 | .. Indices and tables 26 | .. ================== 27 | 28 | .. * :ref:`genindex` 29 | .. * :ref:`modindex` 30 | .. * :ref:`search` 31 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | Installation 2 | ============ 3 | 4 | .. include:: ../README.md 5 | :parser: myst_parser.sphinx_ 6 | :start-after: 7 | :end-before: 8 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/notebooks/sample_seq.gb: -------------------------------------------------------------------------------- 1 | LOCUS Sample_Seq 334 bp ds-DNA circular 20-AUG-2024 2 | DEFINITION . 3 | FEATURES Location/Qualifiers 4 | gene 7..51 5 | /label="example_gene" 6 | ORIGIN 7 | 1 TCCCTTATTC CTGCAGAGTA CATCAATTCT ATGAAGATAT CTTCGGATGG TGTGCCCGTT 8 | 61 GTACATTATA TGTGGTCCAT TTGTGAATTC TTCTTCAAGC AACGTACCTC CCATGCCATA 9 | 121 GAAGTGTCCA GTGGTGGGTA CGAAATTAGG ACACACATAC TTAGTTTCTC ACTTGATGGA 10 | 181 TAGGGACATA CACCGCAATC CGGAATAATT TGGCTACGGG CAGTGTAACT GCAGCCAAAT 11 | 241 CGGCGAGTGG GAACGTTGAA TCGATTCTAG GTGAAATCTT ACGATCCAGT TCGATTGATA 12 | 301 TCTTAGACTC GAATTATTAT CGTCACAGAG GTAG 13 | // -------------------------------------------------------------------------------- /docs/pydna_cheat_sheet.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/pydna_cheat_sheet.odt -------------------------------------------------------------------------------- /docs/pydna_cheat_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/docs/pydna_cheat_sheet.pdf -------------------------------------------------------------------------------- /objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/objects.inv -------------------------------------------------------------------------------- /poetry.toml: -------------------------------------------------------------------------------- 1 | [virtualenvs] 2 | in-project = true 3 | -------------------------------------------------------------------------------- /run_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import os 6 | import logging 7 | import tempfile 8 | import pathlib 9 | import pytest 10 | 11 | pathlib.Path("coverage.xml").unlink(missing_ok=True) 12 | pathlib.Path(".coverage").unlink(missing_ok=True) 13 | 14 | 15 | def main(): 16 | """docstring.""" 17 | os.environ["pydna_data_dir"] = tempfile.mkdtemp(prefix="pydna_data_dir_") 18 | os.environ["pydna_log_dir"] = tempfile.mkdtemp(prefix="pydna_log_dir_") 19 | os.environ["pydna_config_dir"] = tempfile.mkdtemp(prefix="pydna_config_dir_") 20 | os.environ["pydna_loglevel"] = str(logging.DEBUG) 21 | 22 | args = [ 23 | "src", # doctestdir 24 | "--cov=pydna", 25 | "--cov-append", 26 | "--cov-report=html", 27 | "--cov-report=xml", 28 | "--capture=no", 29 | "--durations=10", 30 | # "--import-mode=importlib", 31 | "--nbval", 32 | "--current-env", 33 | "--doctest-modules", 34 | "-vvv", 35 | ] 36 | 37 | return_value_doc_tests = pytest.main(args) 38 | 39 | args = [ 40 | "tests", # test suite 41 | "--cov=pydna", 42 | "--cov-append", 43 | "--cov-report=html", 44 | "--cov-report=xml", 45 | "--capture=no", 46 | "--durations=10", 47 | # "--import-mode=importlib", 48 | "--nbval", 49 | "--current-env", 50 | "--doctest-modules", 51 | "--capture=no", 52 | "-vvv", 53 | "--profile", # profiling 54 | ] 55 | 56 | pth = pathlib.Path("prof/combined.prof") 57 | pth.parent.mkdir(parents=True, exist_ok=True) 58 | pth.write_bytes(b"") 59 | return_value_unit_tests = pytest.main(args) 60 | 61 | import pstats 62 | 63 | stats = pstats.Stats("./prof/combined.prof") 64 | stats.sort_stats("cumulative") 65 | stats.print_stats("pydna/src", 0.1) 66 | 67 | # Or alternatively 68 | # stats.print_stats("local_path", 20) # Only show 20 of the listings 69 | # stats.sort_stats('cumulative').print_stats('dir_name', 20) # Sort by cumulative time 70 | 71 | return_value = return_value_doc_tests + return_value_unit_tests 72 | 73 | print("run_test.py return code:", return_value) 74 | 75 | return return_value 76 | 77 | 78 | if __name__ == "__main__": 79 | sys.exit(main()) 80 | -------------------------------------------------------------------------------- /scripts/BioJSON-master/new_file.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | # os.rmdir("cached") 4 | 5 | import pydna 6 | 7 | import sys 8 | 9 | print(os.environ["pydna_data_dir"]) 10 | print(os.environ["pydna_cache"]) 11 | -------------------------------------------------------------------------------- /scripts/Cloning - Choice of Expression Systems - The 8 least used codons in E. coli, yeast, Drosophila and primates - EMBL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Cloning - Choice of Expression Systems - The 8 least used codons in E. coli, yeast, Drosophila and primates - EMBL.pdf -------------------------------------------------------------------------------- /scripts/LongestCommonSubstring/experiments.py: -------------------------------------------------------------------------------- 1 | """Lyndon.py 2 | Algorithms on strings and sequences based on Lyndon words. 3 | David Eppstein, October 2011.""" 4 | 5 | 6 | def SmallestRotation(s): 7 | """Find the rotation of s that is smallest in lexicographic order. 8 | Duval 1983 describes how to modify his algorithm to do so but I think 9 | it's cleaner and more general to work from the ChenFoxLyndon output.""" 10 | 11 | def ChenFoxLyndonBreakpoints(s): 12 | """Find starting positions of Chen-Fox-Lyndon decomposition of s. 13 | The decomposition is a set of Lyndon words that start at 0 and 14 | continue until the next position. 0 itself is not output, but 15 | the final breakpoint at the end of s is. The argument s must be 16 | of a type that can be indexed (e.g. a list, tuple, or string). 17 | The algorithm follows Duval, J. Algorithms 1983, but uses 0-based 18 | indexing rather than Duval's choice of 1-based indexing.""" 19 | k = 0 20 | while k < len(s): 21 | i, j = k, k + 1 22 | while j < len(s) and s[i] <= s[j]: 23 | i = (s[i] == s[j]) and i + 1 or k # Python cond?yes:no syntax 24 | j += 1 25 | while k < i + 1: 26 | k += j - i 27 | yield k 28 | 29 | def ChenFoxLyndon(s): 30 | """Decompose s into Lyndon words according to the Chen-Fox-Lyndon theorem. 31 | The arguments are the same as for ChenFoxLyndonBreakpoints but the 32 | return values are subsequences of s rather than indices of breakpoints.""" 33 | old = 0 34 | for k in ChenFoxLyndonBreakpoints(s): 35 | yield s[old:k] 36 | old = k 37 | 38 | prev, rep = None, 0 39 | for w in ChenFoxLyndon(s + s): 40 | if w == prev: 41 | rep += 1 42 | else: 43 | prev, rep = w, 1 44 | if len(w) * rep == len(s): 45 | return w * rep 46 | raise Exception("Reached end of factorization with no shortest rotation") 47 | -------------------------------------------------------------------------------- /scripts/LongestCommonSubstring/lcs.py: -------------------------------------------------------------------------------- 1 | from time import time 2 | import numpy as np 3 | 4 | from pydna.common_sub_strings import common_sub_strings 5 | from pydivsufsort import common_substrings 6 | 7 | 8 | def profile(fun, s1, s2): 9 | ans = float("inf") 10 | for _ in range(3): 11 | t = time() 12 | solutions = len(fun(s1, s2, limit=15)) 13 | ans = min(ans, time() - t) 14 | 15 | print(fun, solutions, ans) 16 | 17 | 18 | size = 100_000 19 | s1 = "".join(map(str, np.random.randint(0, 4, size=size, dtype=np.uint8))) 20 | s2 = "".join(map(str, np.random.randint(0, 4, size=size, dtype=np.uint8))) 21 | 22 | profile(common_sub_strings, s1, s2) 23 | profile(common_substrings, s1, s2) 24 | 25 | 26 | common_sub_strings(s1, s2, limit=15) 27 | 28 | reps = 2_000 29 | s1 = "banana" * reps 30 | s2 = "ananas" * reps 31 | profile(common_sub_strings, s1, s2) 32 | profile(common_substrings, s1, s2) 33 | -------------------------------------------------------------------------------- /scripts/LongestCommonSubstring/lecture9-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/LongestCommonSubstring/lecture9-1.pdf -------------------------------------------------------------------------------- /scripts/LongestCommonSubstring/untitled6.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from pydivsufsort import divsufsort, kasai 3 | 4 | string_inp = "banana$" 5 | string_suffix_array = divsufsort(string_inp) 6 | string_lcp_array = kasai(string_inp, string_suffix_array) 7 | print(string_suffix_array, string_lcp_array) 8 | # [6 5 3 1 0 4 2] [0 1 3 0 0 2 0] 9 | 10 | 11 | from SuffixAutomaton import SuffixAutomaton, lcs1, lcs2 12 | 13 | poet = " " 14 | doc = poet.split() 15 | 16 | import random 17 | 18 | a = "".join(random.choice("ACGTURYKSWHBVDN") for i in range(100000)) 19 | b = "".join(random.choice("ACGTURYKSWHBVDN") for i in range(100000)) 20 | 21 | print(lcs1(a, b, 8)) 22 | 23 | from pydna.common_sub_strings import common_sub_strings 24 | 25 | print(common_sub_strings(a, b, 8)) 26 | -------------------------------------------------------------------------------- /scripts/PCR primer parsing/SynthesisReport_3931076.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/PCR primer parsing/SynthesisReport_3931076.pdf -------------------------------------------------------------------------------- /scripts/PCR primer parsing/show-order.tcl.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/PCR primer parsing/show-order.tcl.html -------------------------------------------------------------------------------- /scripts/Ta/19-3-698-t.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/19-3-698-t.pdf -------------------------------------------------------------------------------- /scripts/Ta/Rychlik et al. 1990 - Optimization of the annealing temperature for DNA amplification in vitro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/Rychlik et al. 1990 - Optimization of the annealing temperature for DNA amplification in vitro.pdf -------------------------------------------------------------------------------- /scripts/Ta/TableI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/TableI.png -------------------------------------------------------------------------------- /scripts/Ta/TableII.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/TableII.png -------------------------------------------------------------------------------- /scripts/Ta/table1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/table1.png -------------------------------------------------------------------------------- /scripts/Ta/table2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/Ta/table2.png -------------------------------------------------------------------------------- /scripts/ape_test/ape_test.ape: -------------------------------------------------------------------------------- 1 | LOCUS ape_test 40 bp ds-DNA linear 18-JUN-2016 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT 9 | COMMENT ApEinfo:methylated:1 10 | FEATURES Location/Qualifiers 11 | misc_feature 3..6 12 | /note=hej 13 | /label=hejhej 14 | /ApEinfo_fwdcolor="cyan" 15 | /ApEinfo_revcolor="green" 16 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 17 | width 5 offset 0" 18 | misc_feature complement(15..18) 19 | /label=two 20 | /ApEinfo_fwdcolor="cyan" 21 | /ApEinfo_revcolor="green" 22 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 23 | width 5 offset 0" 24 | misc_feature 29..34 25 | /label=three 26 | /ApEinfo_fwdcolor="cyan" 27 | /ApEinfo_revcolor="green" 28 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 29 | width 5 offset 0" 30 | ORIGIN 31 | 1 aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa 32 | // 33 | -------------------------------------------------------------------------------- /scripts/biosubclasses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Created on Sun May 21 08:08:03 2023 5 | 6 | @author: bjorn 7 | """ 8 | 9 | # pragma: no cover 10 | 11 | # https://stackoverflow.com/questions/57181829/deepcopy-override-clarification 12 | # https://stackoverflow.com/questions/1500718/how-to-override-the-copy-deepcopy-operations-for-a-python-object 13 | # https://stackoverflow.com/questions/24756712/deepcopy-is-extremely-slow 14 | 15 | 16 | from copy import copy as _copy 17 | from copy import deepcopy as _deepcopy 18 | from Bio.SeqFeature import SeqFeature as _SeqFeature 19 | from Bio.SeqFeature import SimpleLocation as _SimpleLocation 20 | from Bio.SeqFeature import ExactPosition as _ExactPosition 21 | 22 | 23 | def empty_copy(obj): 24 | class Empty(obj.__class__): 25 | def __init__(self): 26 | pass 27 | 28 | newcopy = Empty() 29 | newcopy.__class__ = obj.__class__ 30 | return newcopy 31 | 32 | 33 | class ExactPosition(_ExactPosition): 34 | def __copy__(self): 35 | c = empty_copy(self) 36 | c.__dict__ = self.__dict__ 37 | return c 38 | 39 | def __deepcopy__(self, memo): 40 | cls = self.__class__ 41 | result = cls.__new__(cls) 42 | memo[id(self)] = result 43 | for k, v in self.__dict__.items(): 44 | setattr(result, k, _deepcopy(v, memo)) 45 | return result 46 | 47 | 48 | class SimpleLocation(_SimpleLocation): 49 | def __copy__(self): 50 | c = empty_copy(self) 51 | c.__dict__ = self.__dict__ 52 | return c 53 | 54 | def __deepcopy__(self, memo): 55 | cls = self.__class__ 56 | result = cls.__new__(cls) 57 | memo[id(self)] = result 58 | for k, v in self.__dict__.items(): 59 | setattr(result, k, _deepcopy(v, memo)) 60 | return result 61 | 62 | 63 | class SeqFeature(_SeqFeature): 64 | def __copy__(self): 65 | c = empty_copy(self) 66 | c.__dict__ = self.__dict__ 67 | return c 68 | 69 | def __deepcopy__(self, memo): 70 | cls = self.__class__ 71 | result = cls.__new__(cls) 72 | memo[id(self)] = result 73 | for k, v in self.__dict__.items(): 74 | setattr(result, k, _deepcopy(v, memo)) 75 | return result 76 | -------------------------------------------------------------------------------- /scripts/check_my_primers.py: -------------------------------------------------------------------------------- 1 | #!/home/bjorn/anaconda3/envs/bjorn36/bin/python 2 | # -*- coding: utf8 -*- 3 | 4 | 5 | from pydna.myprimers import list_primers 6 | 7 | unique = set(str(p.seq).lower() for p in list_primers) 8 | 9 | print("number of primers", len(list_primers)) 10 | print("unique primers", len(unique)) 11 | print("no seq (n)", len([p for p in list_primers if set(p.seq.lower()) == set("n")])) 12 | 13 | for i, p in enumerate(list_primers): 14 | if not p.name.startswith(str(i)): 15 | print(i, p.format("tab")) 16 | 17 | print("names checked for primer number for ", i + 1, "primers") 18 | 19 | from collections import defaultdict 20 | 21 | dct = defaultdict(list) 22 | 23 | for u in unique: 24 | for p in list_primers: 25 | if set(u) == set("n") or set(p.seq.lower()) == set("n"): 26 | continue 27 | if u == str(p.seq).lower(): 28 | dct[u].append(p.name) 29 | 30 | 31 | for seq, names in dct.items(): 32 | if len(names) > 1: 33 | print("\n".join(names)) 34 | print(seq) 35 | print() 36 | -------------------------------------------------------------------------------- /scripts/compare_local_and_gdoc_primer_lists.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import gspread 5 | import os 6 | from pydrive2.auth import GoogleAuth 7 | from pydrive2.auth import ServiceAccountCredentials 8 | from pydrive2.drive import GoogleDrive 9 | 10 | from pydna.myprimers import PrimerList 11 | from pydna.myprimers import check_primer_numbers 12 | from pydna.parsers import parse_primers 13 | 14 | p = PrimerList() 15 | 16 | check_primer_numbers() 17 | 18 | 19 | def get_google_doc_text(title, mime="application/vnd.google-apps.document"): 20 | """Assumes that a google service account is used. 21 | 22 | See instructions at the docs for gdrive 23 | https://gspread.readthedocs.io/en/latest/oauth2.html 24 | """ 25 | JSON_FILE = os.path.join(gspread.auth.get_config_dir(), "service_account.json") 26 | gauth = GoogleAuth() 27 | scope = ["https://www.googleapis.com/auth/drive"] 28 | gauth.credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_FILE, scope) 29 | gauth.auth_method = "service" 30 | drive = GoogleDrive(gauth) 31 | 32 | fl = drive.ListFile({"q": f"title = '{title}' and mimeType='{mime}'"}).GetList() 33 | 34 | return fl.pop(0).GetContentString(mimetype="text/plain") 35 | 36 | 37 | primer_string = get_google_doc_text("PRIMERS") 38 | 39 | p_gdoc = parse_primers(primer_string) 40 | p_gdoc.reverse() 41 | 42 | for p1, p2 in zip(p, p_gdoc): 43 | if str(p1.seq).lower() != str(p2.seq).lower(): 44 | print(p1) 45 | print(p2) 46 | print("----") 47 | -------------------------------------------------------------------------------- /scripts/conda-build/meta (copy).yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pydna 3 | version: {{ environ.get('GIT_DESCRIBE_TAG', 'default') }} 4 | build: 5 | number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} 6 | include_recipe: False 7 | script: python -m pip install . --no-deps 8 | noarch: python 9 | source: 10 | path: . 11 | requirements: 12 | host: 13 | - python>=3.9,<4.0 14 | - pip 15 | - poetry-core 16 | - poetry-dynamic-versioning 17 | run: 18 | - python 19 | - appdirs>=1.4.4,<2.0.0 20 | - biopython>=1.80,<2.0 21 | - networkx>=2.8.8,<3.0.0 22 | - prettytable>=3.5.0,<4.0.0 23 | - pyperclip>=1.8.2,<2.0.0 24 | - pyfiglet>=0.8.post1,<0.9 25 | - pyparsing>=2.4.7 # optional 26 | - requests>=2.26.0 # optional 27 | - scipy>=1.8.0 # optional 28 | - matplotlib>=3.4.3 # optional 29 | - pillow>=8.4.0 # optional 30 | - CAI>=1.0.3 # optional 31 | - pyqt>=5.0.0 # optional 32 | - pyfiglet>=0.8.post1 # optional 33 | 34 | test: 35 | requires: 36 | - pytest>=4.6.11 37 | - pytest-cov>=3.0.0 38 | - pytest-doctestplus>=0.12.0 39 | - requests-mock>=1.9.3 40 | - nbval>=0.9.6 41 | - coverage>=6.1.2 42 | imports: 43 | - pydna 44 | source_files: 45 | - tests 46 | - src 47 | - src/pydna 48 | about: 49 | home: https://github.com/pydna-group/pydna 50 | license: BSD-3-Clause 51 | license_family: BSD 52 | license_file: LICENSE.txt 53 | summary: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 54 | description: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 55 | doc_url: https://pydna-group.github.io/pydna 56 | dev_url: https://github.com/pydna-group/pydna 57 | extra: 58 | maintainers: 59 | - "Björn Johansson " 60 | -------------------------------------------------------------------------------- /scripts/conda-build/meta (copy2).yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pydna 3 | version: {{ environ.get('GIT_DESCRIBE_TAG', 'default') }} 4 | 5 | build: 6 | number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} 7 | include_recipe: False 8 | script: python -m pip install . --no-deps 9 | noarch: python 10 | source: 11 | path: . 12 | requirements: 13 | host: 14 | - python >=3.9 15 | - pip 16 | - poetry 17 | - poetry-dynamic-versioning 18 | run: 19 | - python 20 | - appdirs>=1.4.4 21 | - biopython>=1.80 22 | - networkx>=2.6.3 23 | - prettytable>=3.2.0 # todo replace with tabulate at some point ? 24 | - pyperclip>=1.8.2 25 | - pyfiglet>=0.8.post1 26 | 27 | - pyparsing>=2.4.7 # optional 28 | - requests>=2.26.0 # optional 29 | - scipy>=1.8.0 # optional 30 | - matplotlib>=3.4.3 # optional 31 | - pillow>=8.4.0 # optional 32 | - CAI>=1.0.3 # optional 33 | - pyqt>=5.0.0 # optional 34 | - pyfiglet>=0.8.post1 # optional 35 | 36 | test: 37 | requires: 38 | - pytest>=4.6.11 39 | - pytest-cov>=3.0.0 40 | - pytest-doctestplus>=0.12.0 41 | - requests-mock>=1.9.3 42 | - nbval>=0.9.6 43 | - coverage>=6.1.2 44 | imports: 45 | - pydna 46 | source_files: 47 | - tests 48 | - src 49 | - src/pydna 50 | about: 51 | home: https://github.com/pydna-group/pydna 52 | license: BSD-3-Clause 53 | license_family: BSD 54 | license_file: LICENSE.txt 55 | summary: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 56 | description: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 57 | doc_url: https://pydna-group.github.io/pydna 58 | dev_url: https://github.com/pydna-group/pydna 59 | extra: 60 | maintainers: 61 | - "Björn Johansson " 62 | -------------------------------------------------------------------------------- /scripts/conda-build/meta2.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: pydna 3 | version: {{ environ.get('GIT_DESCRIBE_TAG', 'default') }} 4 | build: 5 | number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} 6 | include_recipe: False 7 | script: python -m pip install . --no-deps 8 | noarch: python 9 | source: 10 | path: . 11 | requirements: 12 | host: 13 | - python>=3.9,<4.0 14 | - pip 15 | - poetry-core 16 | - poetry-dynamic-versioning 17 | run: 18 | - python 19 | - appdirs>=1.4.4,<2.0.0 20 | - biopython>=1.80,<2.0 21 | - networkx>=2.8.8,<3.0.0 22 | - prettytable>=3.5.0,<4.0.0 23 | - pyperclip>=1.8.2,<2.0.0 24 | - pyfiglet>=0.8.post1,<0.9 25 | - pyparsing>=2.4.7 # optional 26 | - requests>=2.26.0 # optional 27 | - scipy>=1.8.0 # optional 28 | - matplotlib>=3.4.3 # optional 29 | - pillow>=8.4.0 # optional 30 | - CAI>=1.0.3 # optional 31 | - pyqt>=5.0.0 # optional 32 | - pyfiglet>=0.8.post1 # optional 33 | 34 | test: 35 | requires: 36 | - pytest>=4.6.11 37 | - pytest-cov>=3.0.0 38 | - pytest-doctestplus>=0.12.0 39 | - requests-mock>=1.9.3 40 | - nbval>=0.9.6 41 | - coverage>=6.1.2 42 | imports: 43 | - pydna 44 | source_files: 45 | - tests 46 | - src 47 | - src/pydna 48 | about: 49 | home: https://github.com/pydna-group/pydna 50 | license: BSD-3-Clause 51 | license_family: BSD 52 | license_file: LICENSE.txt 53 | summary: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 54 | description: Representing double stranded DNA and simulating cloning, homologous recombination, Gibson assembly, Gel electrophoresis etc. 55 | doc_url: https://pydna-group.github.io/pydna 56 | dev_url: https://github.com/pydna-group/pydna 57 | extra: 58 | maintainers: 59 | - "Björn Johansson " 60 | -------------------------------------------------------------------------------- /scripts/conda-build/myenvironment.yaml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # NOTE: This file has been auto-generated by poetry2conda 3 | # poetry2conda version = 0.3.0 4 | # date: Tue Jan 31 09:15:31 2023 5 | ############################################################################### 6 | # If you want to change the contents of this file, you should probably change 7 | # the pyproject.toml file and then use poetry2conda again to update this file. 8 | # Alternatively, stop using (ana)conda. 9 | ############################################################################### 10 | name: some-name-env 11 | dependencies: 12 | - python>=3.9,<4.0 13 | - conda-forge::appdirs>=1.4.4,<2.0.0 14 | - conda-forge::biopython>=1.80,<2.0 15 | - conda-forge::networkx>=2.8.8,<3.0.0 16 | - conda-forge::prettytable>=3.5.0,<4.0.0 17 | - conda-forge::pyperclip>=1.8.2,<2.0.0 18 | - conda-forge::pyfiglet>=0.8.post1,<0.9 19 | -------------------------------------------------------------------------------- /scripts/conda-build/pydna_build_environment (copy).yml: -------------------------------------------------------------------------------- 1 | name: pydna_build_environment 2 | channels: 3 | - conda-forge 4 | dependencies: 5 | - python==3.11 6 | - appdirs 7 | - biopython>=1.80,<2.0 8 | - networkx 9 | - prettytable 10 | - pyparsing 11 | - bjornfjohansson::CAI 12 | - poetry 13 | - pip 14 | - pip: 15 | - poetry-dynamic-versioning -------------------------------------------------------------------------------- /scripts/conda-build/pydna_build_environment.yml: -------------------------------------------------------------------------------- 1 | name: pydna_build_environment 2 | channels: 3 | - conda-forge 4 | - bjornfjohansson 5 | 6 | dependencies: 7 | - python==3.11 8 | 9 | - appdirs 10 | - biopython==1.80 11 | - networkx 12 | - prettytable 13 | - pyparsing 14 | - CAI 15 | - regex 16 | 17 | - pip 18 | - poetry 19 | - pip: 20 | - poetry-dynamic-versioning 21 | - mamba 22 | - conda-build 23 | - conda-verify -------------------------------------------------------------------------------- /scripts/conda-build/pydna_mamba_build_workflow.yml: -------------------------------------------------------------------------------- 1 | name: Conda Package Build 2 | on: 3 | release: 4 | types: [published] 5 | jobs: 6 | build: 7 | name: Build noarch python package 8 | runs-on: ubuntu-latest 9 | steps: 10 | 11 | - name: ⬇️ Checkout 12 | uses: actions/checkout@v3 13 | with: 14 | fetch-depth: 2 15 | 16 | - name: 🌰 Cache conda 17 | uses: actions/cache@v3 18 | with: 19 | path: ~/conda_pkgs_dir 20 | key: conda-ubuntu-latest-python-build-${{ hashFiles('environment-ci.yml') }} 21 | 22 | - name: 🌍 Install conda environment from pydna_build_environment with miniconda 23 | uses: conda-incubator/setup-miniconda@v2 24 | with: 25 | activate-environment: pydna_build_environment 26 | environment-file: pydna_build_environment.yml 27 | 28 | - name: mamba info --all 29 | shell: bash -l {0} 30 | run: mamba info --all 31 | 32 | - name: mamba config 33 | shell: bash -l {0} 34 | run: conda config --set anaconda_upload yes 35 | 36 | - name: Git tag 37 | shell: bash -l {0} 38 | run: git describe --tags 39 | 40 | - name: 🔩 Check version 41 | shell: bash -l {0} 42 | run: poetry version 43 | 44 | - name: 🔩 Set version 45 | shell: bash -l {0} 46 | run: poetry dynamic-versioning 47 | 48 | - name: 🔩 Check version 49 | shell: bash -l {0} 50 | run: poetry version 51 | 52 | - name: Git tag 53 | shell: bash -l {0} 54 | run: git describe --tags 55 | 56 | - name: 🔩 Build conda package with mamba 57 | shell: bash -l {0} 58 | run: mamba build . --no-test --no-include-recipe --dirty --token ${{ secrets.ANACONDATOKEN }} 59 | -------------------------------------------------------------------------------- /scripts/deps.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths: { 3 | velocity: "https://cdn.jsdelivr.net/velocity/1.2.3/velocity.min", 4 | interact: "https://cdn.jsdelivr.net/interact.js/1.2.6/interact.min", 5 | angular: "https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min" 6 | }, 7 | shim: { 8 | 'angular': { 9 | exports: 'angular' 10 | } 11 | } 12 | }); -------------------------------------------------------------------------------- /scripts/features/BBa_K523026.gff: -------------------------------------------------------------------------------- 1 | ##gff-version 3 2 | ##sequence-region BBa_K523026 1 1326 3 | BBa_K523026 . start_codon 1 1 . + 0 ID=annotation2161708;Name=ATG 4 | BBa_K523026 . CDS 1 1326 . + 0 ID=annotation2161709;Name=xylA 5 | BBa_K523026 . stop_codon 1321 1321 . + 0 ID=annotation2161710;Name=TAATAA 6 | >BBa_K523026 7 | atgcaagcctattttgaccagctcgatcgcgttcgttatgaaggctcaaaatcctcaaacccgttagcattccgtcact 8 | acaatcccgacgaactggtgttgggtaagcgtatggaagagcacttgcgttttgccgcctgctactggcacaccttctg 9 | ctggaacggggcggatatgtttggtgtgggggcgtttaatcgtccgtggcagcagcctggtgaggcactggcgttggcg 10 | aagcgtaaagcagatgtcgcatttgagtttttccacaagttacatgtgccattttattgcttccacgatgtggatgttt 11 | cccctgagggcgcgtcgttaaaagagtacatcaataattttgcgcaaatggttgatgtcctggcaggcaagcaagaaga 12 | gagcggcgtgaagctgctgtggggaacggccaactgctttacaaaccctcgctacggcgcgggtgcggcgacgaaccca 13 | gatcctgaagtcttcagctgggcggcaacgcaagttgttacagcgatggaagcaacccataaattgggcggtgaaaact 14 | atgtcctgtggggcggtcgtgaaggttacgaaacgctgttaaataccgacttgcgtcaggagcgtgaacaactgggccg 15 | ctttatgcagatggtggttgagcataaacataaaatcggtttccagggcacgttgcttatcgaaccgaaaccgcaagaa 16 | ccgaccaaacatcaatatgattacgatgccgcgacggtctatggcttcctgaaacagtttggtctggaaaaagagatta 17 | aactgaacattgaagctaaccacgcgacgctggcaggtcactctttccatcatgaaatagccaccgccattgcgcttgg 18 | cctgttcggttctgtcgacgccaaccgtggcgatgcgcaactgggctgggacaccgaccagttcccgaacagtgtggaa 19 | gagaatgcgctggtgatgtatgaaattctcaaagcaggcggtttcaccaccggtggtctgaacttcgatgccaaagtac 20 | gtcgtcaaagtactgataaatatgatctgttttacggtcatatcggcgcgatggatacgatggcactggcgctgaaaat 21 | tgcagcgcgcatgattgaagatggcgagctggataaacgcatcgcgcagcgttattccggctggaatagcgaattgggc 22 | cagcaaatcctgaaaggccaaatgtcactggcagatttagccaaatatgctcaggaacatcatttgtctccggtgcatc 23 | agagtggtcgccaggaacaactggaaaatctggtaaaccattatctgttcgacaaataataa 24 | -------------------------------------------------------------------------------- /scripts/features/embl.gff: -------------------------------------------------------------------------------- 1 | ##gff-version 3 2 | ##sequence-region BBa_K523026 1 1326 3 | #!Date 2020-05-01 4 | #!Type DNA 5 | #!Source-version EMBOSS 6.6.0.0 6 | BBa_K523026 EMBL CDS 1 1326 . + 0 ID=BBa_K523026.1;locus_tag=xylA;label=xylA;note=ApEinfo_label:xylA;note=ApEinfo_fwdcolor:#d9d9d9;note=ApEinfo_revcolor: #5fd5a3;note=ApEinfo_graphicformat: arrow_data {{0 0.5 0 1 2 0 0 -1 0 -0.5} {} 0} width 5 offset 0 7 | BBa_K523026 EMBL sequence_feature 1 1 . + . ID=BBa_K523026.2;locus_tag=ATG;label=ATG;note=ApEinfo_label:ATG;note=ApEinfo_fwdcolor:#68d9d9;note=ApEinfo_revcolor:#68d9d9;note=ApEinfo_graphicformat: arrow_data {{0 0.5 0 1 2 0 0 -1 0 -0.5} {} 0} width 5 offset 0 8 | BBa_K523026 EMBL sequence_feature 1321 1321 . + . ID=BBa_K523026.3;locus_tag=TAATAA;label=TAATAA;note=ApEinfo_label:TAATAA;note=ApEinfo_fwdcolor:#5fd5a3;note=ApEinfo_revcolor:#5fd5a3;note=ApEinfo_graphicformat: arrow_data {{0 0.5 0 1 2 0 0 -1 0 -0.5} {} 0} width 5 offset 0 9 | ##FASTA 10 | >BBa_K523026 . 11 | atgcaagcctattttgaccagctcgatcgcgttcgttatgaaggctcaaaatcctcaaac 12 | ccgttagcattccgtcactacaatcccgacgaactggtgttgggtaagcgtatggaagag 13 | cacttgcgttttgccgcctgctactggcacaccttctgctggaacggggcggatatgttt 14 | ggtgtgggggcgtttaatcgtccgtggcagcagcctggtgaggcactggcgttggcgaag 15 | cgtaaagcagatgtcgcatttgagtttttccacaagttacatgtgccattttattgcttc 16 | cacgatgtggatgtttcccctgagggcgcgtcgttaaaagagtacatcaataattttgcg 17 | caaatggttgatgtcctggcaggcaagcaagaagagagcggcgtgaagctgctgtgggga 18 | acggccaactgctttacaaaccctcgctacggcgcgggtgcggcgacgaacccagatcct 19 | gaagtcttcagctgggcggcaacgcaagttgttacagcgatggaagcaacccataaattg 20 | ggcggtgaaaactatgtcctgtggggcggtcgtgaaggttacgaaacgctgttaaatacc 21 | gacttgcgtcaggagcgtgaacaactgggccgctttatgcagatggtggttgagcataaa 22 | cataaaatcggtttccagggcacgttgcttatcgaaccgaaaccgcaagaaccgaccaaa 23 | catcaatatgattacgatgccgcgacggtctatggcttcctgaaacagtttggtctggaa 24 | aaagagattaaactgaacattgaagctaaccacgcgacgctggcaggtcactctttccat 25 | catgaaatagccaccgccattgcgcttggcctgttcggttctgtcgacgccaaccgtggc 26 | gatgcgcaactgggctgggacaccgaccagttcccgaacagtgtggaagagaatgcgctg 27 | gtgatgtatgaaattctcaaagcaggcggtttcaccaccggtggtctgaacttcgatgcc 28 | aaagtacgtcgtcaaagtactgataaatatgatctgttttacggtcatatcggcgcgatg 29 | gatacgatggcactggcgctgaaaattgcagcgcgcatgattgaagatggcgagctggat 30 | aaacgcatcgcgcagcgttattccggctggaatagcgaattgggccagcaaatcctgaaa 31 | ggccaaatgtcactggcagatttagccaaatatgctcaggaacatcatttgtctccggtg 32 | catcagagtggtcgccaggaacaactggaaaatctggtaaaccattatctgttcgacaaa 33 | taataa 34 | -------------------------------------------------------------------------------- /scripts/features/experimental_feature.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | """Experimental""" 5 | 6 | from Bio.SeqFeature import SeqFeature 7 | 8 | 9 | class Feature(SeqFeature): 10 | def __init__(self, seq="", *args, **kwargs): 11 | SeqFeature.__init__( 12 | self, 13 | location=None, 14 | type="", 15 | location_operator="", 16 | strand=None, 17 | id="", 18 | qualifiers=None, 19 | sub_features=None, 20 | ref=None, 21 | ref_db=None, 22 | *args, 23 | **kwargs, 24 | ) 25 | self.seq = seq 26 | 27 | 28 | if __name__ == "__main__": 29 | a = Feature(seq="x") 30 | -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/genolib_SBOL_files_from_Tim.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/genolib_SBOL_files_from_Tim.zip -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File005.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File005.pdf -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File006.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File006.pdf -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File007.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File007.pdf -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File008.cys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File008.cys -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File009.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File009.zip -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/nar-03388-h-2014-File010.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/features/files_for_annotation_function/nar-03388-h-2014-File010.zip -------------------------------------------------------------------------------- /scripts/features/files_for_annotation_function/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from lxml import etree 5 | 6 | doc = etree.parse("labhost_Bacillus_subtilis.xml") 7 | 8 | root = doc.getroot() 9 | 10 | for comp in root.iter("{http://sbols.org/v1#}component"): 11 | for c in next(comp.iterchildren()): 12 | print(c.tag) 13 | print(c) 14 | 15 | break 16 | -------------------------------------------------------------------------------- /scripts/gel/bandwagon__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from bandwagon import BandsPattern 5 | from bandwagon import BandsPatternsSet 6 | from bandwagon import custom_ladder 7 | 8 | LADDER_100_to_4k = custom_ladder( 9 | "100-4k", 10 | { 11 | 100: 205, 12 | 200: 186, 13 | 300: 171, 14 | 400: 158, 15 | 500: 149, 16 | 650: 139, 17 | 850: 128, 18 | 1000: 121, 19 | 1650: 100, 20 | 2000: 90, 21 | 3000: 73, 22 | 4000: 65, 23 | }, 24 | ) 25 | 26 | ladder = LADDER_100_to_4k.modified(label="Ladder", background_color="#ffffaf") 27 | 28 | 29 | patterns = [ 30 | BandsPattern([10000, 7750, 4000, 3000, 2000, 1500, 1000, 750, 500], ladder, label="C1"), 31 | BandsPattern([100, 500, 3500], ladder, label="C1"), 32 | BandsPattern([300, 400, 1500], ladder, label="C2"), 33 | BandsPattern([100, 1200, 1400, 3000], ladder, label="C3"), 34 | BandsPattern([100, 700], ladder, label="C4"), 35 | ] 36 | patterns_set = BandsPatternsSet(patterns=[ladder] + patterns, ladder=ladder, label="Test pattern", ladder_ticks=3) 37 | ax = patterns_set.plot() 38 | # ax.figure.savefig("simple_band_patterns.png", bbox_inches="tight", dpi=200) 39 | 40 | 41 | from scipy.interpolate import CubicSpline 42 | 43 | ipolatr = CubicSpline( 44 | [100, 200, 300, 400, 500, 650, 850, 1000, 1650, 2000, 3000, 4000], 45 | [205, 186, 171, 158, 149, 139, 128, 121, 100, 90, 73, 65], 46 | bc_type="natural", 47 | extrapolate=True, 48 | ) 49 | 50 | for b in [10000, 7750, 4000, 3000, 2000, 1500, 1000, 750, 500]: 51 | print(ipolatr(b)) 52 | 53 | 54 | from math import log 55 | 56 | x = 100 57 | fx = 395 - 39.8 * log(x) 58 | print(fx) 59 | -------------------------------------------------------------------------------- /scripts/input_template.ng: -------------------------------------------------------------------------------- 1 |
2 |

{{greeting}},{{name}}

3 | 4 | 5 |
-------------------------------------------------------------------------------- /scripts/log exp/test.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | import logging 3 | import test_log 4 | 5 | 6 | def main(): 7 | logging.error("hello") 8 | 9 | 10 | if __name__ == "__main__": 11 | logging.basicConfig(filename="example.log", filemode="a", level=logging.DEBUG) 12 | 13 | main() 14 | -------------------------------------------------------------------------------- /scripts/log exp/test_log.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | _logger = logging.getLogger(__name__) 4 | -------------------------------------------------------------------------------- /scripts/memo/_xperimental.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | from IPython.lib.latextools import latex_to_png 4 | 5 | 6 | class Circle(object): 7 | def __init__(self, radius): 8 | self.radius = radius 9 | 10 | def _repr_pretty_(self, p, cycle): 11 | p.text("\u25CB") 12 | 13 | def _repr_html_(self): 14 | return "

Cirle: radius=%s

" % self.radius 15 | 16 | def _repr_svg_(self): 17 | return """ 18 | 19 | """ 20 | 21 | def _repr_png_(self): 22 | return latex_to_png("$\circle$") 23 | 24 | 25 | class MyCircle(object): 26 | def _repr_html_(self): 27 | return "○ (html)" 28 | 29 | def _repr_svg_(self): 30 | return """ 31 | 32 | """ 33 | 34 | def _repr_latex_(self): 35 | return r"$\bigcirc \LaTeX$" 36 | 37 | def _repr_javascript_(self): 38 | return "alert('I am a circle!');" 39 | 40 | 41 | if __name__ == "__main__": 42 | import os 43 | 44 | cache = os.getenv("pydna_cache") 45 | os.environ["pydna_cache"] = "nocache" 46 | import doctest 47 | 48 | doctest.testmod() 49 | os.environ["pydna_cache"] = cache 50 | -------------------------------------------------------------------------------- /scripts/memo/download_old.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """Provides a class for downloading sequences from genbank. 4 | """ 5 | import pickle as _pickle 6 | import shelve as _shelve 7 | import os as _os 8 | import requests as _requests 9 | import textwrap as _textwrap 10 | 11 | import logging as _logging 12 | 13 | _module_logger = _logging.getLogger("pydna." + __name__) 14 | 15 | 16 | def download_text(url): 17 | cached = False 18 | refresh = False 19 | cache = _shelve.open( 20 | _os.path.join(_os.environ["pydna_data_dir"], "web"), 21 | protocol=_pickle.HIGHEST_PROTOCOL, 22 | writeback=False, 23 | ) 24 | key = str(url) 25 | 26 | if _os.environ["pydna_cache"] in ("compare", "cached"): 27 | try: 28 | cached = cache[key] 29 | except KeyError: 30 | if _os.environ["pydna_cache"] == "compare": 31 | raise Exception("no result for this key!") 32 | else: 33 | refresh = True 34 | 35 | if refresh or _os.environ["pydna_cache"] in ("compare", "refresh", "nocache"): 36 | req = _requests.get(url) 37 | result = req.text 38 | if _os.environ["pydna_cache"] == "compare": 39 | if result != cached: 40 | _module_logger.warning("download error") 41 | 42 | if refresh or _os.environ["pydna_cache"] == "refresh": 43 | cache = _shelve.open( 44 | _os.path.join(_os.environ["pydna_data_dir"], "genbank"), 45 | protocol=_pickle.HIGHEST_PROTOCOL, 46 | writeback=False, 47 | ) 48 | cache[key] = result 49 | 50 | elif cached and _os.environ["pydna_cache"] not in ("nocache", "refresh"): 51 | result = cached 52 | 53 | cache.close() 54 | 55 | result = _textwrap.dedent(result).strip() 56 | result = result.replace("\r\n", "\n") 57 | result = result.replace("\r", "\n") 58 | return result 59 | 60 | 61 | if __name__ == "__main__": 62 | cache = os.getenv("pydna_cache") 63 | os.environ["pydna_cache"] = "nocache" 64 | import doctest 65 | 66 | doctest.testmod() 67 | os.environ["pydna_cache"] = cache 68 | -------------------------------------------------------------------------------- /scripts/memo/gojs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Created on Tue Jan 10 08:03:27 2017 5 | 6 | @author: bjorn 7 | """ 8 | 9 | from pydna.readers import read 10 | 11 | template = read(">t\\ntacactcaccgtctatcattatctactatcgactgtatcatctgatagcac") 12 | p1 = read(">p1\\ntacactcaccgtctatcattatc", ds=False) 13 | p2 = read(">p2\\ngtgctatcagatgatacagtcg", ds=False) 14 | # ann = pydna.Anneal((p1, p2), template) 15 | -------------------------------------------------------------------------------- /scripts/memo/mem.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | 4 | class memoize(object): 5 | def __init__(self, func): 6 | self.func = func 7 | 8 | def __get__(self, obj, objtype=None): 9 | if obj is None: 10 | return self.func 11 | return partial(self, obj) 12 | 13 | def __call__(self, *args, **kw): 14 | obj = args[0] 15 | key = obj.n 16 | cache = {2: 42} 17 | try: 18 | res = cache[key] 19 | except KeyError: 20 | res = cache[key] = self.func(*args, **kw) 21 | return res 22 | 23 | 24 | if __name__ == "__main__": 25 | 26 | class doubleclass(object): 27 | def __init__(self, n): 28 | self.n = n 29 | 30 | @memoize 31 | def res(self): 32 | return self.n * 2 33 | 34 | x = doubleclass(2) 35 | print(x.res()) 36 | -------------------------------------------------------------------------------- /scripts/memo/mem2.py: -------------------------------------------------------------------------------- 1 | from functools import partial 2 | 3 | 4 | class memoize(object): 5 | def __init__(self, fn): 6 | self.fn = fn 7 | 8 | def __call__(self, func): 9 | def wrappee(*args, **kwargs): 10 | obj = args[0] 11 | key = obj.n # key depends on obj proerties 12 | print(args) 13 | cache = {3: 42, 2: 55} 14 | try: 15 | res = cache[key] 16 | except KeyError: 17 | res = cache[key] = func(*args, **kwargs) 18 | return res 19 | 20 | return wrappee 21 | 22 | 23 | if __name__ == "__main__": 24 | 25 | class doubleclass(object): 26 | def __init__(self, n): 27 | self.n = n 28 | 29 | @memoize("hej") 30 | def res(self): 31 | return self.n * 2 32 | 33 | x = doubleclass(2) 34 | print(x.res()) 35 | -------------------------------------------------------------------------------- /scripts/memo/memmo.py: -------------------------------------------------------------------------------- 1 | def deco(func): 2 | def __init__(self, bird): 3 | self.bird = bird 4 | 5 | def inner(*args): 6 | print("DECORATED: args={}".format(args)) 7 | func(*args) 8 | 9 | return inner 10 | 11 | 12 | class Class: 13 | def __init__(self): 14 | pass 15 | 16 | @deco("and") 17 | def method(self, param): 18 | print("PARAM is {}".format(param)) 19 | 20 | 21 | @deco("anka") 22 | def funk(a, b, c): 23 | print("{} {} {}".format(a, b, c)) 24 | 25 | 26 | x = Class() 27 | 28 | x.method("X") 29 | 30 | funk(1, 2, 3) 31 | -------------------------------------------------------------------------------- /scripts/memo/memo01.py: -------------------------------------------------------------------------------- 1 | import inspect 2 | 3 | 4 | def get_id_tuple( 5 | f, args, kwargs, mark=object() 6 | ): # Some quick'n'dirty way to generate a unique key for an specific call. 7 | l = [id(f)] 8 | for arg in args: 9 | l.append(id(arg)) 10 | l.append(id(mark)) 11 | for k, v in kwargs: 12 | l.append(k) 13 | l.append(id(v)) 14 | return tuple(l) 15 | 16 | 17 | _memoized = {} 18 | 19 | 20 | def memoize(ex): # Some basic memoizer 21 | def decorator(f): 22 | # print(inspect.isclass(f), inspect.ismethod(f), inspect.isfunction(f)) 23 | def memoized(*args, **kwargs): 24 | key = get_id_tuple(f, args, kwargs) 25 | if key not in _memoized: 26 | _memoized[key] = f(*args, **kwargs) 27 | import pickle 28 | 29 | x = f(*args, **kwargs) 30 | print(x.__name__) 31 | pickle.dumps() 32 | return _memoized[key] 33 | 34 | return memoized 35 | 36 | return decorator 37 | 38 | 39 | @memoize("bajs") 40 | class Test(object): 41 | def __init__(self, somevalue): 42 | self.somevalue = somevalue 43 | 44 | 45 | @memoize("phlegm") 46 | def myfunc(x): 47 | return 2 * x 48 | 49 | 50 | class Test2(object): 51 | def __init__(self, somevalue): 52 | self.somevalue = somevalue 53 | 54 | @memoize("piss") 55 | def do(self): 56 | return 2 * self.somevalue 57 | 58 | 59 | tests = [Test(1), Test(2), Test(2)] 60 | for test in tests: 61 | print(test.somevalue, id(test)) 62 | print() 63 | tests = [myfunc(1), myfunc(2), myfunc(2)] 64 | for test in tests: 65 | print(test, id(test)) 66 | print() 67 | tests = [Test2(1), Test2(2), Test2(2)] 68 | for test in tests: 69 | print(test.do(), id(test)) 70 | -------------------------------------------------------------------------------- /scripts/memo/memo02.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def with_print(func): 5 | """Decorate a function to print its arguments.""" 6 | 7 | @wraps(func) 8 | def my_func(*args, **kwargs): 9 | print(args, kwargs) 10 | import pickle 11 | 12 | pickle.dumps(func(*args, **kwargs)) 13 | return func(*args, **kwargs) 14 | 15 | return my_func 16 | 17 | 18 | @with_print 19 | class Test(object): 20 | def __init__(self, somevalue): 21 | self.somevalue = somevalue 22 | 23 | 24 | a = Test(123) 25 | -------------------------------------------------------------------------------- /scripts/memo/meta.py: -------------------------------------------------------------------------------- 1 | import time, pickle, tempfile, os 2 | 3 | 4 | class AutoPickleMeta(type): 5 | def __call__(cls, *args): 6 | t = (int(time.time()) // 10000) * 10000 7 | h = hash(args) 8 | fn = "%s/%s-%i-%i.pickle" % (tempfile.gettempdir(), cls.__name__, t, h) 9 | 10 | if os.path.exists(fn): 11 | # File exists, so load the cPickle and return 12 | with open(fn, "rb") as f: 13 | try: 14 | return pickle.load(f) 15 | 16 | except pickle.UnpicklingError: 17 | # If error occurs assume cPickle file is corrupt, 18 | # and create a new object 19 | f.close() 20 | return cls._do_pickle(fn, args) 21 | 22 | except EOFError: 23 | # File appears empty, return a new object 24 | f.close() 25 | return cls._do_pickle(fn, args) 26 | else: 27 | return cls._do_pickle(fn, args) 28 | 29 | def _do_pickle(cls, fn, args): 30 | # Create object, and return 31 | o = object.__new__(cls, *args) 32 | o.__init__(*args) 33 | with open(fn, "wb") as f: 34 | try: 35 | pickle.dump(o, f, pickle.HIGHEST_PROTOCOL) 36 | 37 | except: 38 | # If anything went wrong, delete the pickle file and re-raise 39 | # exception 40 | f.close() 41 | os.remove(fn) 42 | raise 43 | return o 44 | 45 | 46 | class AutoPickle(object): 47 | __metaclass__ = AutoPickleMeta 48 | -------------------------------------------------------------------------------- /scripts/molecular_weight_standards.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/molecular_weight_standards.ods -------------------------------------------------------------------------------- /scripts/nbpackage/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /scripts/nbpackage/mynotebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [ 10 | { 11 | "name": "stdout", 12 | "output_type": "stream", 13 | "text": [ 14 | "hello from mynotebook!\n" 15 | ] 16 | } 17 | ], 18 | "source": [ 19 | "print \"hello from mynotebook!\"" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 2, 25 | "metadata": { 26 | "collapsed": true 27 | }, 28 | "outputs": [], 29 | "source": [ 30 | "def foo():\n", 31 | " return \"bar\"" 32 | ] 33 | }, 34 | { 35 | "cell_type": "code", 36 | "execution_count": null, 37 | "metadata": { 38 | "collapsed": true 39 | }, 40 | "outputs": [], 41 | "source": [] 42 | } 43 | ], 44 | "metadata": { 45 | "kernelspec": { 46 | "display_name": "Python 2", 47 | "language": "python", 48 | "name": "python2" 49 | }, 50 | "language_info": { 51 | "codemirror_mode": { 52 | "name": "ipython", 53 | "version": 2 54 | }, 55 | "file_extension": ".py", 56 | "mimetype": "text/x-python", 57 | "name": "python", 58 | "nbconvert_exporter": "python", 59 | "pygments_lexer": "ipython2", 60 | "version": "2.7.9" 61 | } 62 | }, 63 | "nbformat": 4, 64 | "nbformat_minor": 0 65 | } 66 | -------------------------------------------------------------------------------- /scripts/notebooks_convert_all_to_html.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import os 4 | import pathlib 5 | import subprocess 6 | 7 | cwd = os.getcwd() 8 | thisdir = os.path.dirname(os.path.realpath(__file__)) 9 | for dirpath, dirnames, filenames in os.walk(thisdir): 10 | if dirpath.startswith((".", "_")): 11 | continue 12 | for file_ in filenames: 13 | if not file_.endswith(".ipynb"): 14 | continue 15 | p = pathlib.Path(os.path.join(dirpath, file_)) 16 | if any([f for f in p.parts if f.startswith(("_", "."))]): 17 | continue 18 | subprocess.run(["jupyter", "nbconvert", str(p)]) 19 | os.chdir(cwd) 20 | print("finished.") 21 | -------------------------------------------------------------------------------- /scripts/notebooks_run_all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import subprocess 4 | import os 5 | import pathlib 6 | import sys 7 | 8 | try: 9 | from termcolor import colored 10 | except ImportError: 11 | 12 | def colored(text, color): 13 | return text 14 | 15 | 16 | thisdir = os.path.dirname(os.path.realpath(__file__)) 17 | 18 | exit_ = 0 19 | exits = 0 20 | notebooks_w_errors = [] 21 | 22 | for dirpath, dirnames, filenames in os.walk(thisdir): 23 | if dirpath.startswith((".", "_")): 24 | continue 25 | for file_ in filenames: 26 | if not file_.endswith(".ipynb"): 27 | continue 28 | pth = pathlib.Path(os.path.join(dirpath, file_)) 29 | if any([f for f in pth.parts if f.startswith(("_", "."))]): 30 | continue 31 | os.chdir(dirpath) 32 | cmd = ["jupyter", "nbconvert", "--execute", "--inplace", file_] 33 | print(colored(dirpath, "blue"), colored(file_, "green"), end="") 34 | prc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 35 | exit_ = prc.returncode 36 | if exit_ == 0: 37 | print(" OK") 38 | else: 39 | print(prc.stderr.decode("utf-8")) 40 | notebooks_w_errors.append(pth) 41 | exits += exit_ 42 | print("run_all.py finished with exit code {}".format(exit_)) 43 | 44 | for nb in notebooks_w_errors: 45 | print(nb) 46 | 47 | sys.exit(exits) 48 | -------------------------------------------------------------------------------- /scripts/notebooks_test_all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import pytest 4 | import os 5 | import pathlib 6 | import sys 7 | 8 | try: 9 | from termcolor import colored 10 | except ImportError: 11 | 12 | def colored(text, color): 13 | return text 14 | 15 | 16 | exit_ = 0 17 | exits = 0 18 | notebooks_w_errors = [] 19 | 20 | thisdir = os.path.dirname(os.path.realpath(__file__)) 21 | 22 | 23 | for dirpath, dirnames, filenames in sorted(os.walk(thisdir)): 24 | if dirpath.startswith((".", "_")): 25 | continue 26 | for file_ in filenames: 27 | if not file_.endswith(".ipynb"): 28 | continue 29 | if file_ == "index.ipynb": 30 | continue 31 | p = pathlib.Path(os.path.join(dirpath, file_)) 32 | if any([f for f in p.parts if f.startswith(("_", "."))]): 33 | continue 34 | os.chdir(dirpath) 35 | print("\n\n") 36 | print(colored(dirpath, "blue"), colored(file_, "red")) 37 | exit_ = pytest.cmdline.main(["--verbose", "--capture=no", "--nbval", file_]) 38 | if exit_: 39 | notebooks_w_errors.append(p) 40 | exits += exit_ 41 | 42 | print("finished with exit code {}".format(exit_)) 43 | 44 | print("Notebooks with errors:") 45 | for nb in notebooks_w_errors: 46 | print(nb) 47 | 48 | sys.exit(exits) 49 | -------------------------------------------------------------------------------- /scripts/pGUP1-2/GUP1rec1sens.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec1sens 2 | gaattcgatatcaagcttatcgataccgatgtcgctgatcagcatcctgtc -------------------------------------------------------------------------------- /scripts/pGUP1-2/GUP1rec2AS.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec2AS 2 | gacataactaattacatgactcgaggtcgactcagcattttaggtaaattccg -------------------------------------------------------------------------------- /scripts/persistent cache decorator.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def memo(f): 5 | @wraps(f) 6 | def wrapper(*args, **kwds): 7 | x = f(*args, **kwds) 8 | # make decisions here on when to retrieve cache depending on env variables etc.. 9 | # right now we only have a saved value for 1+2+3 10 | # 11 | if x.key == "1+2+3": # we know 1+2+3 is 6, we can use the cached value 12 | print("cached value returned") 13 | return 6 14 | return x.sum() # <-- this method has to have the same name in all 15 | 16 | return wrapper 17 | 18 | 19 | class Example: 20 | """Docstring for Example class""" 21 | 22 | @memo 23 | def __init__(self, a=1, b=2, c=3): 24 | self.a = a 25 | self.b = b 26 | self.c = c 27 | 28 | def sum(self): 29 | print("value calculated") 30 | return self.a + self.b + self.c 31 | 32 | 33 | print(Example(1, 2, 3)) 34 | 35 | print(Example(1, 2, 4)) 36 | 37 | print(Example.__doc__) 38 | -------------------------------------------------------------------------------- /scripts/predefined_feature_colors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Created on Sat Mar 30 06:59:58 2019 @author: bjorn 4 | 5 | import colorsys 6 | 7 | from pydna.dseqrecord import Dseqrecord 8 | 9 | from Bio.SeqFeature import SeqFeature, FeatureLocation 10 | 11 | seq = Dseqrecord("") 12 | 13 | colors = [] 14 | 15 | for hue in range(0, 360, 36): 16 | for s in [0.2, 0.4, 0.6]: 17 | r, g, b = colorsys.hsv_to_rgb(hue / 360, s, 255) 18 | r, g, b = int(r), int(g), int(b) 19 | hex = "#{0:02x}{1:02x}{2:02x}".format(r, g, b) 20 | colors.append(f"{hex}") 21 | 22 | colors = colors[::3] + colors[1::3] + colors[2::3] 23 | colors = colors[::-1] 24 | for hex in colors: 25 | sf = SeqFeature(FeatureLocation(1, 9, strand=1), type="misc_feature") 26 | sf.qualifiers["label"] = [ 27 | hex, 28 | ] 29 | sf.qualifiers["ApEinfo_fwdcolor"] = [ 30 | hex, 31 | ] 32 | se = Dseqrecord("agtagtcgta") 33 | se.features.append(sf) 34 | seq += se 35 | 36 | from pydna.editor import ape 37 | 38 | ape(seq) 39 | 40 | print(colors) 41 | -------------------------------------------------------------------------------- /scripts/pydna_gel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/pydna_gel.png -------------------------------------------------------------------------------- /scripts/pydna_test/MySeq2.gb: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 80 bp ds-DNA linear 18-APR-2018 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT ApEinfo:methylated:1 9 | FEATURES Location/Qualifiers 10 | CDS 8..73 11 | /locus_tag="MyGene" 12 | /label="MyGene" 13 | /ApEinfo_label="MyGene" 14 | /ApEinfo_fwdcolor="#00ff24" 15 | /ApEinfo_revcolor="green" 16 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 17 | width 5 offset 0" 18 | variation 32..32 19 | /locus_tag="MyMutation" 20 | /label="MyMutation" 21 | /ApEinfo_label="MyMutation" 22 | /ApEinfo_fwdcolor="#e43931" 23 | /ApEinfo_revcolor="green" 24 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 25 | width 5 offset 0" 26 | ORIGIN 27 | 1 atgtcgtATG aaaccgttat cgatcatatg tGcgaaatgt cgcgcgtcat ctacgtatca 28 | 61 tcgatctact TAAacgtgta 29 | // 30 | -------------------------------------------------------------------------------- /scripts/pydna_test/MySeq2_copied.gb: -------------------------------------------------------------------------------- 1 | LOCUS MySeq2 80 bp ds-DNA linear 18-APR-2018 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT 9 | COMMENT ApEinfo:methylated:1 10 | FEATURES Location/Qualifiers 11 | CDS 8..73 12 | /locus_tag="MyGene" 13 | /label="MyGene" 14 | /ApEinfo_label="MyGene" 15 | /ApEinfo_fwdcolor="#00ff24" 16 | /ApEinfo_revcolor="green" 17 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 18 | width 5 offset 0" 19 | variation 32..32 20 | /locus_tag="MyMutation" 21 | /label="MyMutation" 22 | /ApEinfo_label="MyMutation" 23 | /ApEinfo_fwdcolor="#e43931" 24 | /ApEinfo_revcolor="green" 25 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 26 | width 5 offset 0" 27 | ORIGIN 28 | 1 atgtcgtATG aaaccgttat cgatcatatg tGcgaaatgt cgcgcgtcat ctacgtatca 29 | 61 tcgatctact TAAacgtgta 30 | // 31 | -------------------------------------------------------------------------------- /scripts/pydna_test/jupyter_note_book.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [], 10 | "source": [] 11 | } 12 | ], 13 | "metadata": { 14 | "anaconda-cloud": {}, 15 | "kernelspec": { 16 | "display_name": "Python 3", 17 | "language": "python", 18 | "name": "python3" 19 | }, 20 | "language_info": { 21 | "codemirror_mode": { 22 | "name": "ipython", 23 | "version": 3 24 | }, 25 | "file_extension": ".py", 26 | "mimetype": "text/x-python", 27 | "name": "python", 28 | "nbconvert_exporter": "python", 29 | "pygments_lexer": "ipython3", 30 | "version": "3.8.5" 31 | } 32 | }, 33 | "nbformat": 4, 34 | "nbformat_minor": 0 35 | } 36 | -------------------------------------------------------------------------------- /scripts/pydna_test/python_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from pydna.all import * 5 | 6 | MySeq2 = read("/home/bjorn/Desktop/pydna_test/MySeq2_copied.gb") 7 | with open("/home/bjorn/Desktop/pydna_test/MySeq2_copied.gb") as f: 8 | MySeq2_copied = read(f.read()) 9 | 10 | # reading looses text uppercase/lowercase 11 | 12 | assert MySeq2_copied.format() == MySeq2.format() 13 | 14 | # print(MySeq2.list_features()) 15 | # +-----+--------------+-----+-----+-----+-----+-----------+------+ 16 | # | Ft# | Label/Note | Dir | Sta | End | Len | type | orf? | 17 | # +-----+--------------+-----+-----+-----+-----+-----------+------+ 18 | # | 0 | L:MyGene | --> | 7 | 73 | 66 | CDS | yes | 19 | # | 1 | L:MyMutation | --> | 31 | 32 | 1 | variation | no | 20 | # +-----+--------------+-----+-----+-----+-----+-----------+------+ 21 | 22 | mg = MySeq2.extract_feature(0) 23 | mg2 = MySeq2.features[0].extract(MySeq2) 24 | 25 | assert mg.format() == mg2.format(), mg == mg2 26 | 27 | mgc = MySeq2_copied.extract_feature(0) 28 | mgc2 = MySeq2_copied.features[0].extract(MySeq2_copied) 29 | 30 | assert mgc.format() == mgc2.format(), mgc == mgc2 31 | 32 | assert mg == mg2 != mgc == mgc2 # a path property is added to mg and mg2 from MySeq2 33 | 34 | assert mg2.format() == mgc.format() 35 | 36 | mp = primer_design(mg) 37 | 38 | ## default Dseqrecord field content should be globally available somehow 39 | 40 | 41 | slc = MySeq2[2:-2] 42 | 43 | assert slc.name == slc.id == "MySeq2" 44 | 45 | 46 | MySeq = Dseqrecord("atgtcgtATGaaaccgttatcgatcatatgtGcgaaatgtcgcgcgtcatctacgtatcatcgatctactTAAacgtgta") 47 | 48 | # LOCUS name 80 bp DNA linear UNK 18-APR-2018 49 | # DEFINITION description. 50 | # ACCESSION id 51 | # VERSION id 52 | # KEYWORDS . 53 | # SOURCE . 54 | # ORGANISM . 55 | # . 56 | # FEATURES Location/Qualifiers 57 | # ORIGIN 58 | # 1 atgtcgtatg aaaccgttat cgatcatatg tgcgaaatgt cgcgcgtcat ctacgtatca 59 | # 61 tcgatctact taaacgtgta 60 | # // 61 | -------------------------------------------------------------------------------- /scripts/python pptx example/python pptx example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from pptx import Presentation 5 | from pptx.enum.shapes import MSO_SHAPE 6 | from pptx.util import Inches 7 | 8 | prs = Presentation() 9 | title_only_slide_layout = prs.slide_layouts[5] 10 | slide = prs.slides.add_slide(title_only_slide_layout) 11 | shapes = slide.shapes 12 | 13 | shapes.title.text = "Adding an AutoShape" 14 | 15 | left = Inches(0.93) # 0.93" centers this overall set of shapes 16 | top = Inches(3.0) 17 | width = Inches(1.75) 18 | height = Inches(1.0) 19 | 20 | shape = shapes.add_shape(MSO_SHAPE.PENTAGON, left, top, width, height) 21 | shape.text = "Step 1" 22 | 23 | left = left + width - Inches(0.4) 24 | width = Inches(2.0) # chevrons need more width for visual balance 25 | 26 | for n in range(2, 6): 27 | shape = shapes.add_shape(MSO_SHAPE.CHEVRON, left, top, width, height) 28 | shape.text = "Step %d" % n 29 | left = left + width - Inches(0.4) 30 | 31 | prs.save("test.pptx") 32 | -------------------------------------------------------------------------------- /scripts/python pptx example/test.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/python pptx example/test.pptx -------------------------------------------------------------------------------- /scripts/remove_local_and_remote_alpha_git_tags.sh: -------------------------------------------------------------------------------- 1 | # This script removes git tags like 1.2.3a12 both locally and remotely 2 | # https://gist.github.com/matthewmccullough/898798 3 | re_alpha="^[0-9]\.[0-9]\.[0-9]a[0-9]+$" 4 | for tag in `git tag` 5 | do 6 | if [[ $tag =~ $re_alpha ]] 7 | then 8 | echo $tag 9 | git push origin :$tag 10 | git tag -d $tag 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /scripts/simple_band_patterns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/simple_band_patterns.png -------------------------------------------------------------------------------- /scripts/smallest_rotation/duval_algorithm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/smallest_rotation/duval_algorithm -------------------------------------------------------------------------------- /scripts/smallest_rotation/duval_algorithm.rs: -------------------------------------------------------------------------------- 1 | // A string is called simple (or a Lyndon word), if it is strictly smaller than any of its own nontrivial suffixes. 2 | // Duval (1983) developed an algorithm for finding the standard factorization that runs in linear time and constant space. 3 | // Source: https://en.wikipedia.org/wiki/Lyndon_word 4 | 5 | fn factorization_with_duval(s: &[u8]) -> Vec { 6 | let n = s.len(); 7 | let mut i = 0; 8 | let mut factorization: Vec = Vec::new(); 9 | 10 | while i < n { 11 | let mut j = i + 1; 12 | let mut k = i; 13 | 14 | while j < n && s[k] <= s[j] { 15 | if s[k] < s[j] { 16 | k = i; 17 | } else { 18 | k += 1; 19 | } 20 | j += 1; 21 | } 22 | 23 | while i <= k { 24 | factorization.push(String::from_utf8(s[i..i + j - k].to_vec()).unwrap()); 25 | i += j - k; 26 | } 27 | } 28 | 29 | factorization 30 | } 31 | 32 | pub fn duval_algorithm(s: &str) -> Vec { 33 | return factorization_with_duval(s.as_bytes()); 34 | } 35 | 36 | 37 | fn main() { 38 | // Your program will start here. 39 | let text = "abcdabcdababcabcdabcdababc"; 40 | println!("{:?}", factorization_with_duval(text.as_bytes())); 41 | } 42 | -------------------------------------------------------------------------------- /scripts/smallest_rotation/smallest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int smallest_rotation_index(char *s) { 6 | int n = strlen(s); 7 | int i = 0, j = 1, k = 0; 8 | while (i < n && j < n && k < n) { 9 | int cmp = s[(i+k)%n] - s[(j+k)%n]; 10 | if (cmp == 0) { 11 | k++; 12 | } else { 13 | if (cmp > 0) { 14 | i = i + k + 1; 15 | } else { 16 | j = j + k + 1; 17 | } 18 | if (i == j) { 19 | j++; 20 | } 21 | k = 0; 22 | } 23 | } 24 | return i < j ? i : j; 25 | } 26 | 27 | void reverse(char *a, int n) { 28 | 29 | for (int i=0, j=n-1; i < j; i++, j--) { 30 | a[i] = a[i] ^ a[j]; 31 | a[j] = a[j] ^ a[i]; 32 | a[i] = a[i] ^ a[j]; 33 | } 34 | } 35 | 36 | 37 | char * smallest_rotation(char *myString) 38 | { 39 | int n = strlen(myString); 40 | int k = n - smallest_rotation_index(myString); 41 | 42 | reverse(&myString[n-k], k); // reverse end of array 43 | reverse(myString, n-k); // reverse beginning of array 44 | reverse(myString, n); // reverse entire array 45 | 46 | return myString; 47 | 48 | } 49 | 50 | int main() { 51 | char s[] = "cabcdab"; 52 | 53 | char * s2 = smallest_rotation(s); 54 | 55 | printf("%s\n", s2); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /scripts/smallest_rotation/smallest.h: -------------------------------------------------------------------------------- 1 | #include "smallest.c" -------------------------------------------------------------------------------- /scripts/smallest_rotation/smallest2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int min_cyc(const string &s) 6 | { 7 | int n = s.size(); 8 | int res = 0; 9 | for (int l = 0; l < n; ) 10 | { 11 | res = l; 12 | int r = l, p = l + 1; 13 | for (; r < n; ++r, ++p) /// If there is such string found, then its length wont exceed |s| 14 | { 15 | char c = (p < n) ? s[p] : s[p - n]; /// to avoid modulo 16 | if (s[r] > c) break; 17 | if (s[r] < c) r = l - 1; 18 | } 19 | l = max(r, l + p - r); /// just skip those (s2 = sx + sx + ... + sx + sy) cases 20 | } 21 | return res; 22 | } 23 | 24 | int main() 25 | { 26 | string s; 27 | cin >> s; 28 | cout << min_cyc(s); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /scripts/smallest_rotation/smallest_ext.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static PyObject *method_fputs(PyObject *self, PyObject *args) { 5 | char *str, *filename = NULL; 6 | int bytes_copied = -1; 7 | 8 | /* Parse arguments */ 9 | if(!PyArg_ParseTuple(args, "ss", &str, &filename)) { 10 | return NULL; 11 | } 12 | 13 | FILE *fp = fopen(filename, "w"); 14 | bytes_copied = fputs(str, fp); 15 | fclose(fp); 16 | 17 | return PyLong_FromLong(bytes_copied); 18 | } -------------------------------------------------------------------------------- /scripts/speed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import timeit 4 | 5 | s = """\ 6 | a="aaa" 7 | """ 8 | timeit.timeit(stmt=s, number=10000000) 9 | 10 | setup = """\ 11 | from pydna.dseqrecord import Dseqrecord 12 | from pydna.contig import Contig 13 | """ 14 | 15 | s = """\ 16 | a=Contig(Dseqrecord("aaa")) 17 | """ 18 | timeit.timeit(stmt=s, setup=setup, number=10000000) 19 | 20 | abcde = " 234" 21 | 22 | 23 | print(abcde) 24 | -------------------------------------------------------------------------------- /scripts/spyder_start.py: -------------------------------------------------------------------------------- 1 | #!/home/bjorn/anaconda/envs/bjorn/bin/python 2 | """ 3 | import os 4 | import sys 5 | os.environ["PYTHONDONTWRITEBYTECODE"] = "True" 6 | sys.dont_write_bytecode = True 7 | dna_dir = u"/home/bjorn/Dropbox/Public/pydna-DNA-assembly//constructs" 8 | dna_dirs = [x[0] for x in os.walk(dna_dir)] 9 | os.environ["pydna_dna_dirs"] = os.pathsep.join(dna_dirs) 10 | os.environ["PYTHONPATH"] = os.environ["pydna_dna_dirs"] 11 | """ 12 | 13 | from spyderlib import start_app 14 | 15 | start_app.main() 16 | -------------------------------------------------------------------------------- /scripts/test_primer_id.py: -------------------------------------------------------------------------------- 1 | from pydna.design import primer_design 2 | from pydna.dseqrecord import Dseqrecord 3 | 4 | t = Dseqrecord("atgactgctaacccttccttggtgttgaacaagatcgacgacatttcgttcgaaacttacgatg") 5 | from pydna.primer import Primer 6 | 7 | pf = Primer("atgactgctaacccttccttggtg") 8 | print(pf.name) 9 | ampl = primer_design(t, fp=pf) 10 | print(ampl.forward_primer.name) 11 | -------------------------------------------------------------------------------- /scripts/tracer/sequencings/Order_3504177_Results.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/tracer/sequencings/Order_3504177_Results.zip -------------------------------------------------------------------------------- /scripts/tracer/sequencings/Untitled Folder/test2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/tracer/sequencings/Untitled Folder/test2.scf -------------------------------------------------------------------------------- /scripts/tracer/sequencings/test.ab1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/tracer/sequencings/test.ab1 -------------------------------------------------------------------------------- /scripts/tracer/sequencings/test.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/tracer/sequencings/test.zip -------------------------------------------------------------------------------- /scripts/tracer/sequencings/test2.scf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/scripts/tracer/sequencings/test2.scf -------------------------------------------------------------------------------- /src/pydna/_pretty.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | """Classes for nicer Jupyter output. 4 | 5 | The pretty_str class is similar to str but has a _repr_pretty_ method 6 | for for nicer string output in the IPython shell and Jupyter notebook. 7 | """ 8 | 9 | from prettytable import PrettyTable as _Pt 10 | from prettytable import MARKDOWN as _md 11 | 12 | from copy import copy as _copy 13 | from typing import List as _List 14 | 15 | 16 | class pretty_str(str): 17 | """Thanks to Min RK, UC Berkeley for this.""" 18 | 19 | def _repr_pretty_(self, p, cycle): 20 | p.text(self) 21 | 22 | 23 | class PrettyTable(_Pt): 24 | """docstring.""" 25 | 26 | def lol(self) -> _List[list]: 27 | """docstring.""" 28 | return [self._field_names] + self._rows 29 | 30 | def __repr__(self) -> str: 31 | """docstring.""" 32 | return self.get_string() 33 | 34 | def _repr_markdown_(self) -> pretty_str: 35 | c = _copy(self) 36 | c.set_style(_md) 37 | return pretty_str(c.get_string()) 38 | 39 | 40 | if __name__ == "__main__": 41 | import os as _os 42 | 43 | cached = _os.getenv("pydna_cached_funcs", "") 44 | _os.environ["pydna_cached_funcs"] = "" 45 | import doctest 46 | 47 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 48 | _os.environ["pydna_cached_funcs"] = cached 49 | -------------------------------------------------------------------------------- /src/pydna/all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | """This module provide most pydna functionality in the local namespace. 8 | 9 | Example 10 | ------- 11 | 12 | >>> from pydna.all import * 13 | >>> Dseq("aaa") 14 | Dseq(-3) 15 | aaa 16 | ttt 17 | >>> Dseqrecord("aaa") 18 | Dseqrecord(-3) 19 | >>> from pydna.all import __all__ 20 | >>> __all__ 21 | ['Anneal', 'pcr', 'Assembly', 'genbank', 'Genbank', 'download_text\ 22 | ', 'Dseqrecord', 'Dseq', 'read', 'read_primer', 'parse', 'parse_primers\ 23 | ', 'ape', 'primer_design', 'assembly_fragments', 'circular_assembly_fragments\ 24 | ', 'eq', 'gbtext_clean', 'PrimerList'] 25 | >>> 26 | """ 27 | 28 | 29 | __all__ = [ 30 | "Anneal", 31 | "pcr", 32 | "Assembly", 33 | "genbank", 34 | "Genbank", 35 | "download_text", 36 | "Dseqrecord", 37 | "Dseq", 38 | "read", 39 | "read_primer", 40 | "parse", 41 | "parse_primers", 42 | "ape", 43 | "primer_design", 44 | "assembly_fragments", 45 | "circular_assembly_fragments", 46 | "eq", 47 | "gbtext_clean", 48 | "PrimerList", 49 | ] 50 | 51 | 52 | from pydna.amplify import Anneal 53 | from pydna.amplify import pcr 54 | from pydna.assembly import Assembly 55 | from pydna.genbank import genbank 56 | from pydna.genbank import Genbank 57 | from pydna.download import download_text 58 | from pydna.dseqrecord import Dseqrecord 59 | from pydna.dseq import Dseq 60 | from pydna.readers import read 61 | from pydna.readers import read_primer 62 | from pydna.parsers import parse 63 | from pydna.parsers import parse_primers 64 | from pydna.editor import ape 65 | from pydna.design import primer_design 66 | from pydna.design import assembly_fragments 67 | from pydna.design import circular_assembly_fragments 68 | from pydna.utils import eq 69 | from pydna.genbankfixer import gbtext_clean 70 | from pydna.myprimers import PrimerList 71 | 72 | 73 | if __name__ == "__main__": 74 | import os as _os 75 | 76 | cached = _os.getenv("pydna_cached_funcs", "") 77 | _os.environ["pydna_cached_funcs"] = "" 78 | import doctest 79 | 80 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 81 | _os.environ["pydna_cached_funcs"] = cached 82 | -------------------------------------------------------------------------------- /src/pydna/conftest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """conftest.py""" 3 | 4 | # import pathlib 5 | # import os 6 | 7 | # cwd = pathlib.Path(__file__).parent 8 | 9 | # def pytest_runtest_setup(item): 10 | # # called for running each test in 'a' directory 11 | # #os.chdir(cwd) 12 | # pass 13 | 14 | 15 | # def pytest_configure(config): 16 | # """ 17 | # Allows plugins and conftest files to perform initial configuration. 18 | # This hook is called for every plugin and initial conftest 19 | # file after command line options have been parsed. 20 | # """ 21 | # os.chdir(cwd) 22 | # print(f"cwd set to {cwd} in {__file__}") 23 | 24 | 25 | # def pytest_sessionstart(session): 26 | # """ 27 | # Called after the Session object has been created and 28 | # before performing collection and entering the run test loop. 29 | # """ 30 | 31 | 32 | # def pytest_sessionfinish(session, exitstatus): 33 | # """ 34 | # Called after whole test run finished, right before 35 | # returning the exit status to the system. 36 | # """ 37 | 38 | 39 | # def pytest_unconfigure(config): 40 | # """ 41 | # called before test process is exited. 42 | # """ 43 | -------------------------------------------------------------------------------- /src/pydna/download.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | """Provides a function for downloading online text files.""" 8 | 9 | import textwrap as _textwrap 10 | 11 | import os as _os 12 | from pydna._pretty import pretty_str as _pretty_str 13 | from pydna.utils import memorize as _memorize 14 | import logging as _logging 15 | 16 | _module_logger = _logging.getLogger("pydna." + __name__) 17 | 18 | 19 | @_memorize("pydna.download.download_text") 20 | def download_text(url): 21 | """docstring.""" 22 | import requests 23 | 24 | _module_logger.info("#### DOWNLOAD TEXT ####") 25 | _module_logger.info("url = %s", url) 26 | req = requests.get(url) 27 | _module_logger.info("url = %s", str(req)) 28 | result = _textwrap.dedent(req.text).strip() 29 | result = result.replace("\r\n", "\n").replace("\r", "\n") 30 | _module_logger.info("result[:160] = %s", result[:160]) 31 | return _pretty_str(result) 32 | 33 | 34 | if __name__ == "__main__": 35 | cached = _os.getenv("pydna_cached_funcs", "") 36 | _os.environ["pydna_cached_funcs"] = "" 37 | import doctest 38 | 39 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 40 | _os.environ["pydna_cached_funcs"] = cached 41 | -------------------------------------------------------------------------------- /src/pydna/fakeseq.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | """docstring.""" 8 | 9 | 10 | class FakeSeq: 11 | """docstring.""" 12 | 13 | def __init__( 14 | self, 15 | length: int, 16 | n: float = 50e-15, # 50 fmol = 0.05 pmol 17 | rf: float = 0.0, 18 | ) -> None: 19 | self._length = length 20 | self.n = n 21 | self.rf = rf 22 | 23 | def m(self) -> float: 24 | """Mass of the DNA molecule in grams.""" 25 | # M(Da) * n (mol) = g 26 | return self.M() * self.n 27 | 28 | def M(self) -> float: 29 | """M grams/mol.""" 30 | return (308.9 * self._length + 79.0) * 2 31 | 32 | def __len__(self) -> int: 33 | """docstring.""" 34 | return self._length 35 | 36 | def __lt__(self, other) -> bool: 37 | """docstring.""" 38 | return self._length < len(other) 39 | 40 | def __repr__(self) -> str: 41 | """docstring.""" 42 | return f"FakeSeq({self._length:.1e})" 43 | 44 | def __str__(self) -> str: 45 | """docstring.""" 46 | return self.__repr__() 47 | 48 | 49 | if __name__ == "__main__": 50 | import os as _os 51 | 52 | cached = _os.getenv("pydna_cached_funcs", "") 53 | _os.environ["pydna_cached_funcs"] = "" 54 | import doctest 55 | 56 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 57 | _os.environ["pydna_cached_funcs"] = cached 58 | -------------------------------------------------------------------------------- /src/pydna/genbankfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | from pydna.dseqrecord import Dseqrecord as _Dseqrecord 8 | 9 | 10 | class GenbankFile(_Dseqrecord): 11 | def __init__(self, record, *args, path=None, **kwargs): 12 | super().__init__(record, *args, **kwargs) 13 | self.path = path 14 | 15 | @classmethod 16 | def from_SeqRecord(cls, record, *args, path=None, **kwargs): 17 | obj = super().from_SeqRecord(record, *args, **kwargs) 18 | obj.path = path 19 | return obj 20 | 21 | def __repr__(self): 22 | """returns a short string representation of the object""" 23 | return "File({})({}{})".format(self.id, {True: "-", False: "o"}[not self.circular], len(self)) 24 | 25 | def _repr_pretty_(self, p, cycle): 26 | """returns a short string representation of the object""" 27 | p.text("File({})({}{})".format(self.id, {True: "-", False: "o"}[not self.circular], len(self))) 28 | 29 | def _repr_html_(self): 30 | return "{path}
".format(path=self.path) 31 | 32 | def reverse_complement(self): 33 | answer = type(self)(super().reverse_complement(), path=self.path) 34 | return answer 35 | 36 | rc = reverse_complement 37 | 38 | 39 | if __name__ == "__main__": 40 | import os as _os 41 | 42 | cached = _os.getenv("pydna_cached_funcs", "") 43 | _os.environ["pydna_cached_funcs"] = "" 44 | import doctest 45 | 46 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 47 | _os.environ["pydna_cached_funcs"] = cached 48 | -------------------------------------------------------------------------------- /src/pydna/goldengate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | 8 | # ^^ 9 | # ^^ .. .. 10 | # [] [] 11 | # .:[]:_ ^^ ,:[]:. 12 | # .: :[]: :-. ,-: :[]: :. 13 | # .: : :[]: : :`._ ,.': : :[]: : :. 14 | # .: : : :[]: : : : :-._ _,-: : : : :[]: : : :. 15 | # _..: : : : :[]: : : : : : :-._________.-: : : : : : :[]: : : : :-._ 16 | # _:_:_:_:_:_:[]:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:[]:_:_:_:_:_:_ 17 | # !!!!!!!!!!!![]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![]!!!!!!!!!!!!! 18 | # ^^^^^^^^^^^^[]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[]^^^^^^^^^^^^^ 19 | # [] [] 20 | # [] [] 21 | # [] [] 22 | # ~~^-~^_~^~/ \~^-~^~_~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/ \~^-~_~^-~~- 23 | # ~ _~~- ~^-^~-^~~- ^~_^-^~~_ -~^_ -~_-~~^- _~~_~-^_ ~^-^~~-_^-~ ~^ 24 | 25 | """Assembly of sequences by GoldenGate ligation assembly.""" 26 | from Bio.Restriction import BsaI, BsmBI, BbsI, FokI 27 | from pydna.dseqrecord import Dseqrecord as _Dseqrecord 28 | 29 | # from copy import deepcopy as _deepcopy 30 | import logging as _logging 31 | 32 | _module_logger = _logging.getLogger("pydna." + __name__) 33 | 34 | BsaI, BsmBI, BbsI, FokI 35 | 36 | DNA = _Dseqrecord("gatcGAAGACtagagtctgattcg") 37 | 38 | a, b = DNA.cut(BbsI) 39 | 40 | assert a + b == DNA 41 | 42 | 43 | # MoClo 44 | 45 | # https://edinburgh-genome-foundry.github.io/GoldenHinges 46 | -------------------------------------------------------------------------------- /src/pydna/ligate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | """docstring.""" 8 | from operator import add 9 | from functools import reduce 10 | import networkx as _nx 11 | from itertools import permutations 12 | import logging as _logging 13 | 14 | _module_logger = _logging.getLogger("pydna." + __name__) 15 | 16 | 17 | def ligate(fragments: list): 18 | """docstring.""" 19 | G = _nx.DiGraph() 20 | G.add_nodes_from(["begin", "end"]) 21 | fragments = fragments[:] 22 | 23 | fragments.extend(f.rc() for f in fragments[1:]) 24 | 25 | for node in fragments: 26 | G.add_edge("begin", node) 27 | G.add_edge(node, "end") 28 | 29 | for seq1, seq2 in permutations(fragments, 2): 30 | try: 31 | seq1 + seq2 32 | except TypeError as err: 33 | if str(err) != "sticky ends not compatible!": 34 | raise 35 | else: 36 | if seq1.seq.three_prime_end() != ( 37 | "blunt", 38 | "", 39 | ) and seq2.seq.five_prime_end() != ("blunt", ""): 40 | G.add_edge(seq1, seq2) 41 | try: 42 | G.remove_edge("begin", seq2) 43 | except _nx.NetworkXError as err: 44 | if "not in graph" not in str(err): 45 | raise 46 | try: 47 | G.remove_edge(seq1, "end") 48 | except _nx.NetworkXError as err: 49 | if "not in graph" not in str(err): 50 | raise 51 | 52 | cpaths = [p for p in sorted(_nx.simple_cycles(G), key=len) if len(p) > 1] 53 | csequences = [reduce(add, x).looped() for x in cpaths] 54 | lpaths = [p for p in sorted(_nx.all_simple_paths(G, "begin", "end"), key=len) if len(p) > 3] 55 | lsequences = [reduce(add, lp[1:-1]) for lp in lpaths] 56 | 57 | return csequences, lsequences 58 | 59 | 60 | if __name__ == "__main__": 61 | import os as _os 62 | 63 | cached = _os.getenv("pydna_cached_funcs", "") 64 | _os.environ["pydna_cached_funcs"] = "" 65 | import doctest 66 | 67 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 68 | _os.environ["pydna_cached_funcs"] = cached 69 | -------------------------------------------------------------------------------- /src/pydna/myenzymes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | """This module establish a RestrictionBatch based on enzymes found in a text file specified in the enzymes entry 8 | in the python.ini file or by the environment variable pydna_enzymes. 9 | 10 | The text file will be searched for all enzymes in the biopython 11 | AllEnzymes batch which is located in the Bio.Restriction package. 12 | 13 | The pydna.myenzymes.myenzymes contains a new restriction batch with the enzymes contained 14 | within the file specified. 15 | """ 16 | 17 | import os as _os 18 | import re as _re 19 | from Bio.Restriction import AllEnzymes as _AllEnzymes 20 | from Bio.Restriction import RestrictionBatch as _RestrictionBatch 21 | import logging as _logging 22 | import traceback as _traceback 23 | 24 | _module_logger = _logging.getLogger("pydna." + __name__) 25 | 26 | 27 | _text = "" 28 | 29 | 30 | try: 31 | with open(_os.environ["pydna_enzymes"], encoding="utf-8") as _f: 32 | _text = _f.read() 33 | except FileNotFoundError: 34 | _module_logger.warning("%s not found.", _os.environ["pydna_enzymes"]) 35 | except IsADirectoryError: 36 | _module_logger.warning("%s is a directory.", _os.environ["pydna_enzymes"]) 37 | except IOError: 38 | _module_logger.warning("%s found, but could not be read.", _os.environ["pydna_enzymes"]) 39 | except Exception: 40 | _module_logger.warning(_traceback.format_exc()) 41 | 42 | 43 | myenzymes = _RestrictionBatch([e for e in _AllEnzymes if str(e).lower() in _re.split(r"\W+", _text.lower())]) 44 | 45 | if __name__ == "__main__": 46 | cache = _os.getenv("pydna_cache") 47 | _os.environ["pydna_cache"] = "nocache" 48 | import doctest 49 | 50 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 51 | _os.environ["pydna_cache"] = cache 52 | -------------------------------------------------------------------------------- /src/pydna/primer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | 8 | """This module provide the Primer class that is a subclass of the biopython SeqRecord.""" 9 | 10 | from pydna.seq import Seq as _Seq 11 | from pydna.seqrecord import SeqRecord as _SeqRecord 12 | 13 | 14 | class Primer(_SeqRecord): 15 | """Primer and its position on a template, footprint and tail.""" 16 | 17 | def __init__(self, record, *args, amplicon=None, position=None, footprint=0, **kwargs): 18 | if hasattr(record, "features"): # Seqrecord 19 | self.__dict__.update(record.__dict__) 20 | self.__dict__.update(kwargs) 21 | elif hasattr(record, "transcribe"): # Seq 22 | super().__init__(record, *args, **kwargs) 23 | else: # string? 24 | super().__init__(_Seq(record), *args, **kwargs) 25 | self.amplicon = amplicon 26 | self.position = position 27 | self._fp = footprint or len(record) 28 | 29 | @property 30 | def footprint(self): 31 | return self.seq[-self._fp :] if self._fp else "" 32 | 33 | @property 34 | def tail(self): 35 | return self.seq[: -self._fp] if self._fp else "" 36 | 37 | def __repr__(self): 38 | s = min((self.seq, "{}..{}".format(self.seq[:15], self.seq[-3:])), key=len) 39 | return "{id} {len}-mer:5'-{seq}-3'".format(id=self.id, len=len(self), seq=s) 40 | 41 | def __radd__(self, other): 42 | new = super().__radd__(other) 43 | return Primer(new, position=self.position, footprint=self._fp) 44 | 45 | def __getitem__(self, index): 46 | result = super().__getitem__(index) 47 | if hasattr(index, "indices"): # index is a slice 48 | i1, i2, i3 = index.indices(len(self)) 49 | j1, j2, j3 = slice(-(self._fp or 0), None).indices(len(self)) 50 | result._fp = self._fp - (i1 - j1 > 0) * abs(i1 - j1) 51 | return result 52 | 53 | def reverse_complement(self, *args, **kwargs): 54 | """Return the reverse complement of the sequence.""" 55 | answer = super().reverse_complement(*args, **kwargs) 56 | answer.amplicon = None 57 | answer.position = None 58 | answer._fp = len(self) 59 | return answer 60 | 61 | 62 | if __name__ == "__main__": 63 | import os as _os 64 | 65 | cached = _os.getenv("pydna_cached_funcs", "") 66 | _os.environ["pydna_cached_funcs"] = "" 67 | import doctest 68 | 69 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 70 | _os.environ["pydna_cached_funcs"] = cached 71 | -------------------------------------------------------------------------------- /src/pydna/readers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | 8 | """Provides two functions, read and read_primer.""" 9 | from pydna.parsers import parse as _parse 10 | from pydna.primer import Primer as _Primer 11 | 12 | 13 | def read(data, ds=True): 14 | """This function is similar the :func:`parse` function but expects one and only 15 | one sequence or and exception is thrown. 16 | 17 | Parameters 18 | ---------- 19 | data : string 20 | see below 21 | ds : bool 22 | Double stranded or single stranded DNA, if True return 23 | Dseqrecord objects, else Bio.SeqRecord objects. 24 | 25 | Returns 26 | ------- 27 | Dseqrecord 28 | contains the first Dseqrecord or SeqRecord object parsed. 29 | 30 | Notes 31 | ----- 32 | 33 | The data parameter is similar to the data parameter for :func:`parse`. 34 | 35 | See Also 36 | -------- 37 | parse 38 | 39 | """ 40 | 41 | try: 42 | (result,) = _parse(data, ds) 43 | except ValueError as err: 44 | if "too many" in str(err): 45 | print(f"More than one sequence found in data:\n({str(data)[:79]})") 46 | elif "not enough" in str(err): 47 | print(f"No sequence found in data:\n({str(data)[:79]})") 48 | raise 49 | return result 50 | 51 | 52 | def read_primer(data): 53 | """Use this function to read a primer sequence from a string or a local file. 54 | The usage is similar to the :func:`parse_primer` function.""" 55 | 56 | return _Primer(read(data, ds=False)) 57 | 58 | 59 | if __name__ == "__main__": 60 | import os as _os 61 | 62 | cached = _os.getenv("pydna_cached_funcs", "") 63 | _os.environ["pydna_cached_funcs"] = "" 64 | import doctest 65 | 66 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 67 | _os.environ["pydna_cached_funcs"] = cached 68 | -------------------------------------------------------------------------------- /src/pydna/sequence_picker.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 4 | # This code is part of the Python-dna distribution and governed by its 5 | # license. Please see the LICENSE.txt file that should have been included 6 | # as part of this package. 7 | 8 | from pydna.dseqrecord import Dseqrecord 9 | import os as _os 10 | import logging as _logging 11 | from Bio.Blast import NCBIWWW 12 | from Bio.Blast import NCBIXML 13 | 14 | _module_logger = _logging.getLogger("pydna." + __name__) 15 | 16 | 17 | email = _os.getenv("pydna_email") 18 | tool = "pydna" 19 | 20 | 21 | def genbank_accession(s: str) -> Dseqrecord: 22 | """docstring.""" 23 | s = Dseqrecord(s) 24 | 25 | NCBIWWW.email = email 26 | NCBIWWW.tool = tool 27 | 28 | result_handle = NCBIWWW.qblast( 29 | "blastn", 30 | "nt", 31 | str(s.seq), 32 | hitlist_size=1, 33 | alignments=1, 34 | descriptions=1, 35 | expect=1e-8, 36 | megablast=True, 37 | service="megablast", 38 | ungapped_alignment=True, 39 | ) 40 | 41 | blast_records = NCBIXML.read(result_handle) 42 | best_alignment, *rest = blast_records.alignments 43 | best_hsp, *rest = best_alignment.hsps 44 | dbs = best_hsp.sbjct 45 | start, stop = sorted((best_hsp.sbjct_start, best_hsp.sbjct_end)) 46 | result = Dseqrecord( 47 | dbs, 48 | circular=False, 49 | id=s.name, 50 | name=s.name, 51 | description=(f"{best_alignment.accession} " f"REGION: {start}..{stop}"), 52 | ) 53 | return result 54 | 55 | 56 | if __name__ == "__main__": 57 | cached = _os.getenv("pydna_cached_funcs", "") 58 | _os.environ["pydna_cached_funcs"] = "" 59 | import doctest 60 | 61 | doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS) 62 | _os.environ["pydna_cached_funcs"] = cached 63 | pass 64 | -------------------------------------------------------------------------------- /src/pydna/user_cloning.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # Copyright 2013-2023 by Björn Johansson. All rights reserved. 5 | # This code is part of the Python-dna distribution and governed by its 6 | # license. Please see the LICENSE.txt file that should have been included 7 | # as part of this package. 8 | 9 | 10 | # from abc import ABC, abstractmethod 11 | # import re 12 | # from pydna.utils import rc 13 | 14 | 15 | """ 16 | Nicking & USER cloning 17 | 18 | 19 | CGAuGTCGACTTAGATCTCACAGGCTTTTTTCAAGaCGGCCTTGAATTCAGTCATTTGGATCCGGCCGATC 20 | GCTACAGCTGAATCTAGAGTGTCCGAAAAAAGTTCTGCCGGAACTTAAGTCAGTAAACCTAGGCCGGCuAG 21 | 22 | 1. Digest both strands 23 | 2. Collect all linear ssDNA 24 | 3. Anneal all combinations 25 | 4. Keep ones present in original molecule 26 | 5. Rank by stability 27 | 6. 28 | 29 | """ 30 | -------------------------------------------------------------------------------- /tests/.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = pydna 4 | omit = 5 | */tests/* 6 | */_version.py 7 | */_sequencetrace.py 8 | */gel.py 9 | */gel2.py 10 | 11 | [report] 12 | exclude_lines = 13 | pragma: no cover 14 | if __name__==.__main__.: 15 | if __name__ ==.__main__.: 16 | if __name__== .__main__.: 17 | if __name__ == .__main__.: 18 | ignore_errors = True 19 | -------------------------------------------------------------------------------- /tests/02-G1_B01_013.ab1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/02-G1_B01_013.ab1 -------------------------------------------------------------------------------- /tests/1362_6.ape: -------------------------------------------------------------------------------- 1 | >1362_6 2 | ATGGCAGATCTTCTGAATATAAAGAAGGTAGAATATGTGGGAAATAAGAGCCCCCAAGCTGGCGATGGGTTCCACTACTACAATCCCGAAGAACAGGTAATGGGAAAAAGTATGAAGGAGTGGTTGAAGTTTAGTGTCGCGTATTGGCATACCATGGATCAGCGTCTGGTAGACCCATTTGGAGAAGGTACAGCAGTGCGTCCGTGGGATAAAGAGGGGGCTCCCGGCTCCATGGAGGAAGCGTTAGGCAAAGTAGATTACATGTTTGAATTCCTGGATAAGATGAATGTGGAATACTTCGCCTTTCATGATAGAGACTTGGCGCCTGAAGGAAACACGCTTAGGGAAACCAACGAGAACTTGAATAAGGTAGTAGATAAGATAGAGGCAAAGATGCAGGAGACCGGCAAAAAATTACTGTGGAACACAAGCTCTCTGTTTACAAATAAACGTTTTCTAGCGGGGGGCGCTACCACGCCATTTGCCGAGGTGTTTGCTTACGCTGCTGCCCAGGTAAAAAACAGTCTAGACATCGCCAAGAGATTAGGTAGTGAGTCATACGTTTTTTGGGGAGGCAGAGAAGGCTACGACTTTCTACTGAATACGGATACAAAAAGAGAGCTTGATCATATCGCAGCTTTCTTCAAACTAGCAAAAGATTATGCCAACGAGATTGGATATAAAGGACAATTCTTAATAGAGCCGAAACCGAAGGAACCTACACAACACCAGTATGATTTTGATGTCCAGACGACAATTGCATTCTTAAAAACATATGGTCTGGAGAATGATTTCAAACTGAATCTGGAGGGTAACCATACTTACTTGGCCGGACACACTTACGAGCACGAGGCTAGATTTGCTAGAGAAGCTGGCCTATTAGGATCCCTGGACGCGAACATGGGGGATAAACTAATTGGATGGGACATAGACGAGTTCCCAAATGATATTTACGAGGCCACACTTGTCATGTACGAATTTCTTAAGAATGGAGGGCTACCCACGGGGGGATTAAATTTCGACTCTAAGCCCCGTAGGCAATCATTTGAAATGGAAGACTTGAGGCTTGCCCACATGGCTGGCATGGATATTTATGCGGCTGGGTTAAAAGTGGCGGCAAAGATGATTGAAGACAACTTCTTTGAAAACGTACTGAAAGAGAGGTATGGTTCATTTGACTCTGGAATCGGCGCAGACTTTGAAGCTGGGAAAGTCAGTTTCGCGGATTTCGAGAGCTATATTATCGACAAAACGGATGAGGAGATCAACGCTAACTTAAAGTCAGGCAGACAAGAGCAAATAAAAGCTACAGTAAATAATTATATTTTTTCCGTACTAGGTAAGTAA 3 | -------------------------------------------------------------------------------- /tests/15405_2.ape: -------------------------------------------------------------------------------- 1 | >15405_2 2 | ATGGCTGACCTTCTGGATATGAAAAAGGTTGAATATGTCGGGAACAAAAGCGTCCAGGCCGGAGACGGTTTTCATTACTATAACCCGGACGAACAGGTAATGGGCAAGCCTATGAAGGACTGGTTAAAATTTTCTGTAGCTTATTGGCACACGATGGATCAAAGGTTAGTGGACCCTTTTGGAGAGGGCACCGCGGTGAGGCCGTGGGATAAAGAAGGCGCGCCGGGTTCAATGGAGGAGGCACTTGGAAAAGTTGATTATATGTTCGAATTCCTGGAGAAAATGAACATAGAGTATTTTGCTTTTCATGATAGGGACCTAGCTCCCGAGGGTAACACCCTACGTGAGACCAATGAGAACTTAAATAAAGTAGTTGATAAGATAGAGGCTAAAATGCAGGAGACCGGTAAGAAGCTGTTATGGAATACCTCATCCCTGTTTACTAATAAGAGATTTCTGGCAGGTGGGGCAACCACTCCTTTTGCTGAGGTCTTTGCATACGCGGCCGCCCAAGTGAAAAATTCATTGGACATAGCTAAACGTCTAGGGAGTGAATCTTACGTATTCTGGGGCGGGCGTGAGGGTTATGACTTTTTATTGAACACAGATACGAAGAGAGAGCTTGACCACATTGCCGCATTCTTTAAGTTAGCGAAAGACTACGCAAATGAGATCGGTTATACGGGACAATTCTTAATAGAACCTAAGCCAAAAGAACCGACACAACACCAGTACGATTTCGACGTTCAAACTACCATCGCATTTCTAAAAACATACGGATTAGAGAATGACTTTAAGTTAAATCTAGAGGGAAATCACGCATACCTTGCGGGCCATACGTACGAACACGAGGTTCGTTTTGCTAGGGAGGCAGGCTTACTGGGCTCCCTTGACGCTAACATGGGAGATAAACTGATCGGTTGGGACATCGACGAATTTCCGAACGATATTTATGAGGCCACAATGGTAATGTATGAGTTCCTGAAGAATGGGGGTCTAGCGACTGGAGGGCTAAATTTTGACTCTAAACCGAGAAGACAGTCATTTCAGGCTGAAGACCTTAGACTTGCCCATATCGCTGGTATGGACGTCTACGCAGCGGGTCTTAAAGTTGCCGCAAAGATGATAGAGGACAACTTTTTGGAAAACATACTGAAGGAACGTTACGGCAGTTTCGACAGCGGTATAGGCGCTGACTTCGAAGCAGGCAAGGTCTCCTTTAAAGACTTCGAGAGTTACATAATTGACAAGACTGACGATGAAATTAACGCTAACCTAAAATCAGGAAGACAGGAGGAAATCAAATCCACGCTGAACAATTACATCTTTAAGGTATTGGGCAACTAG 3 | -------------------------------------------------------------------------------- /tests/28-1rev_D04_026.ab1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/28-1rev_D04_026.ab1 -------------------------------------------------------------------------------- /tests/32-3rev_H04_018.ab1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/32-3rev_H04_018.ab1 -------------------------------------------------------------------------------- /tests/36-5rev_D05_041.ab1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/36-5rev_D05_041.ab1 -------------------------------------------------------------------------------- /tests/8054_2.ape: -------------------------------------------------------------------------------- 1 | >8054_2 2 | ATGACATACTTTCCCACAGTGGAGAAGATAAAATTTGAGGGCAAGGAGTCCAAGAATCCGCTGGCGTTTAGGTATTACGACCCCGAGAAGATGGTCTACGGTAAAAAGATGAAGGACTGGTTCAAATTTTCCATGGCCTGGTGGCATACTTTGTGTGCGGAGGGCGGCGACCCTTTCGGTGGGGGTACAAAAACGTTCCCATGGGCACAAGGTAGCTCTGCCTTAGAGGTGGCGAAACAGCGTCTGGATGCCGGCTTTGAGTTTATGCAGAAAATAGGCATCGAGTATTACTGCTTCCACGATATTGATTTGATCTCAGAAGGTGATAGTATCGAGGAATACGAAAGCAACCTGAAAGCGATTGTGGCATACGCTAAGCAAAAACAAGCGGAAACGGGAATAAAGCTTCTATGGGGCACAGCGAACGTTTTCAGTCATAAAAGGTACATGAACGGGGCCGCGACAAACCCGGACTTCGAAGTGGTTAGCAGGGCAGCGCTACAGATAAAGAATGCAATTGACGCGACCATCGAGTTGGGTGGTGAGAACTACGTCTTCTGGGGAGGTAGAGAGGGGTACTCTTCCCTGCTTAACACAGAGATGAAGAGAGAAAAAGATCATCTTGCGACCATCTTAACCAAGGCAAGAGATTATGCTCGTAGTAAAGGCTTTAAGGGCAACTTTCTAATTGAACCAAAACCTATGGAGCCCACCAAACATCAATACGATGTCGATACAGAAACGGTGATAGGATTTTTAAGGGCGCATGGTCTGGATAAGGATTTTAAAGTGAACATAGAAGTTAATCACGCAACGTTGGCTGGGCATACCTTTGAGCATGAATTGCAATGCGCCGTAGACGCCGGCATGCTAGGCTCAATAGACGCGAACAGGGGGGACTATCAAAATGGTTGGGACACAGATCAGTTCCCCGTTGATGTGAATGAACTTACTCAAGCGATGCTTGTAATTTTGAAGGGCGGCGGCTTGCAGGGTGGTGGTACTAATTTCGATGCGAAGACAAGGCGTAACTCCACAGACTTAGAAGATATTTTTATTGCGCATATAGCCGGAATGGATACTTTCGCCCGTGCACTTGAGTCTGCGGCAGCGCTATTGGAAGACTCTCCGTACGAGAAGATGTTAAAGGACAGATATGCGTCATTCGATGCCGGTAAAGGCAAGGAGTTTGAAGATGGGAAGCTATCACTTGAAGACATTGTAGCATATGCGAAGTCCAAAGGGGGCGAACCGGCCCAAATCAGTGGTAAACAGGAGCTGTATGAGGCGCTGGTAAACATGTATATCTAA 3 | -------------------------------------------------------------------------------- /tests/AAA_OLD.gb: -------------------------------------------------------------------------------- 1 | LOCUS name? 6 bp DNA circular UNK 01-JAN-2018 2 | DEFINITION description?. 3 | ACCESSION id? 4 | VERSION id? 5 | KEYWORDS . 6 | SOURCE . 7 | ORGANISM . 8 | . 9 | FEATURES Location/Qualifiers 10 | ORIGIN 11 | 1 ggatcn 12 | // 13 | -------------------------------------------------------------------------------- /tests/ABI01.abi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/ABI01.abi -------------------------------------------------------------------------------- /tests/AJ515744.gb: -------------------------------------------------------------------------------- 1 | LOCUS AJ515744 23 bp DNA linear SYN 05-JAN-2004 2 | DEFINITION Artificial oligonucleotide primer sequence (Sh2p-3) for Sarcophilus 3 | laniarius microsatellite PCR analysis. 4 | ACCESSION AJ515744 5 | VERSION AJ515744.1 6 | KEYWORDS oligonucleotide; primer. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 11 | AUTHORS Jones,M.E., Paetkou,D., Geffen,E. and Moritz,C. 12 | TITLE Microsatellites for the Tasmanian devil (Sarcophilus laniarius) 13 | JOURNAL Mol. Ecol. Notes 3 (2), 277-279 (2003) 14 | REFERENCE 2 (bases 1 to 23) 15 | AUTHORS Jones,M.E. 16 | TITLE Direct Submission 17 | JOURNAL Submitted (12-NOV-2002) Jones M.E., School of Zoology, University 18 | of Tasmania, GPO Box 252-5, Hobart, TAS, 7001, AUSTRALIA 19 | FEATURES Location/Qualifiers 20 | source 1..23 21 | /organism="synthetic construct" 22 | /mol_type="other DNA" 23 | /db_xref="taxon:32630" 24 | /note="synthetic oligonucleotide" 25 | misc_feature 1..23 26 | /note="locus Sh2p 3' primer for Sarcophilus laniarius 27 | microsatellite PCR analysis" 28 | ORIGIN 29 | 1 gcaatcctgg tcatgatgta gtc 30 | // 31 | -------------------------------------------------------------------------------- /tests/AJ515746.gb: -------------------------------------------------------------------------------- 1 | LOCUS AJ515746 21 bp DNA linear SYN 05-JAN-2004 2 | DEFINITION Artificial oligonucleotide primer sequence (Sh3a-3) for Sarcophilus 3 | laniarius microsatellite PCR analysis. 4 | ACCESSION AJ515746 5 | VERSION AJ515746.1 6 | KEYWORDS oligonucleotide; primer. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 11 | AUTHORS Jones,M.E., Paetkou,D., Geffen,E. and Moritz,C. 12 | TITLE Microsatellites for the Tasmanian devil (Sarcophilus laniarius) 13 | JOURNAL Mol. Ecol. Notes 3 (2), 277-279 (2003) 14 | REFERENCE 2 (bases 1 to 21) 15 | AUTHORS Jones,M.E. 16 | TITLE Direct Submission 17 | JOURNAL Submitted (12-NOV-2002) Jones M.E., School of Zoology, University 18 | of Tasmania, GPO Box 252-5, Hobart, TAS, 7001, AUSTRALIA 19 | FEATURES Location/Qualifiers 20 | source 1..21 21 | /organism="synthetic construct" 22 | /mol_type="other DNA" 23 | /db_xref="taxon:32630" 24 | /note="synthetic oligonucleotide" 25 | misc_feature 1..21 26 | /note="locus Sh3a 3' primer for Sarcophilus laniarius 27 | microsatellite PCR analysis" 28 | ORIGIN 29 | 1 cttcccctgt aagtgtattt g 30 | // 31 | -------------------------------------------------------------------------------- /tests/AJ580803.gb: -------------------------------------------------------------------------------- 1 | LOCUS AJ580803 20 bp DNA linear SYN 18-AUG-2003 2 | DEFINITION Artificial oligonucleotide forward primer sequence for 3 | Coxsackievirus A24 VP-3 to VP-1 region PCR analysis. 4 | ACCESSION AJ580803 5 | VERSION AJ580803.1 6 | KEYWORDS oligonucleotide; primer. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 11 | AUTHORS Kishore,J. and Isomura,S. 12 | TITLE Detection & differentiation of Coxsackie A 24 variant isolated from 13 | an epidemic of acute haemorrhagic conjunctivitis in north India by 14 | RT-PCR using a novel primer pair 15 | JOURNAL Indian J. Med. Res. 115, 176-183 (2002) 16 | PUBMED 12362556 17 | REFERENCE 2 (bases 1 to 20) 18 | AUTHORS Kishore,J. 19 | TITLE Direct Submission 20 | JOURNAL Submitted (16-AUG-2003) Kishore J., Microbiology, Sanjay Gandhi 21 | P.G.I.M.S., Lucknow, Uttar pradesh-226014, INDIA 22 | COMMENT Related entry AJ580804. Primer pair does not amplify Human 23 | enterovirus 70 the other cause of acute haemorrhagic conjunctivitis 24 | epidemics. 25 | FEATURES Location/Qualifiers 26 | source 1..20 27 | /organism="synthetic construct" 28 | /mol_type="other DNA" 29 | /db_xref="taxon:32630" 30 | /note="synthetic oligonucleotide" 31 | misc_feature 1..20 32 | /note="forward primer designed against the standard strain 33 | of Coxsackievirus A24 VP-3 to VP-1 region" 34 | ORIGIN 35 | 1 gcctgcccag atttcagtgt 36 | // 37 | -------------------------------------------------------------------------------- /tests/AJ580804.gb: -------------------------------------------------------------------------------- 1 | LOCUS AJ580804 20 bp DNA linear SYN 18-AUG-2003 2 | DEFINITION Artificial oligonucleotide reverse primer sequence for 3 | Coxsackievirus A24 VP-3 to VP-1 region PCR analysis. 4 | ACCESSION AJ580804 5 | VERSION AJ580804.1 6 | KEYWORDS oligonucleotide; primer. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 11 | AUTHORS Kishore,J. and Isomura,S. 12 | TITLE Detection & differentiation of Coxsackie A 24 variant isolated from 13 | an epidemic of acute haemorrhagic conjunctivitis in north India by 14 | RT-PCR using a novel primer pair 15 | JOURNAL Indian J. Med. Res. 115, 176-183 (2002) 16 | PUBMED 12362556 17 | REFERENCE 2 (bases 1 to 20) 18 | AUTHORS Kishore,J. 19 | TITLE Direct Submission 20 | JOURNAL Submitted (16-AUG-2003) Kishore J., Microbiology, Sanjay Gandhi 21 | P.G.I.M.S., Lucknow, Uttar pradesh-226014, INDIA 22 | COMMENT Related entry AJ580803. Primer pair does not amplify Human 23 | enterovirus 70 the other cause of acute haemorrhagic conjunctivitis 24 | epidemics. 25 | FEATURES Location/Qualifiers 26 | source 1..20 27 | /organism="synthetic construct" 28 | /mol_type="other DNA" 29 | /db_xref="taxon:32630" 30 | /note="synthetic oligonucleotide" 31 | misc_feature 1..20 32 | /note="reverse primer designed against the standard strain 33 | of Coxsackievirus A24 VP-3 to VP-1 region" 34 | ORIGIN 35 | 1 gtcagcttcg gtcgtggcgt 36 | // 37 | -------------------------------------------------------------------------------- /tests/AM086621.gb: -------------------------------------------------------------------------------- 1 | LOCUS AM086621 24 bp DNA linear SYN 14-JUL-2008 2 | DEFINITION Artificial oligonucleotide primer sequence (PsnRT_F) for 3 | Pseudomonas savastanoi pv. nerii isolate ITM204 PCR detection. 4 | ACCESSION AM086621 5 | VERSION AM086621.1 6 | KEYWORDS oligonucleotide; primer. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 11 | AUTHORS Tegli,S., Cerboneschi,M., Marsili Libelli,I. and Fontana,F. 12 | TITLE Detection and identification of Pseudomonas savastanoi by end point 13 | and realtime PCR 14 | JOURNAL Unpublished 15 | REFERENCE 2 (bases 1 to 24) 16 | AUTHORS Tegli,S. 17 | TITLE Direct Submission 18 | JOURNAL Submitted (16-SEP-2005) Tegli S., Dipartimento di Biotecnologie 19 | Agrarie, Universita degli Studi di Firenze, Via della Lastruccia 20 | 10, Sesto Fiorentino (Firenze) 50019, ITALY 21 | COMMENT Related sequences: AM051226.1 (Reverse primer PsnR1d). 22 | FEATURES Location/Qualifiers 23 | source 1..24 24 | /organism="synthetic construct" 25 | /mol_type="other DNA" 26 | /db_xref="taxon:32630" 27 | misc_feature 1..24 28 | /note="PsnRT_F primer for Pseudomonas savastanoi pv. nerii 29 | isolate ITM204 PCR detection" 30 | ORIGIN 31 | 1 gctcattcgc ttgttatcac ttca 32 | // 33 | -------------------------------------------------------------------------------- /tests/E05006.gb: -------------------------------------------------------------------------------- 1 | LOCUS E05006 25 bp DNA linear PAT 04-NOV-2005 2 | DEFINITION PCR primer to generate NcoI and SphI site adjacent to T7 promoter 3 | on pGEMEX2. 4 | ACCESSION E05006 5 | VERSION E05006.1 6 | KEYWORDS JP 1993105699-A/1. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 (bases 1 to 25) 11 | AUTHORS Mori,T., Takada,T., Koike,K. and Sugano,H. 12 | TITLE PRODUCTION OF B TYPE HEPATITIS VIRUS X PROTEIN AND DIAGNOSTIC AGENT 13 | USING THE SAME 14 | JOURNAL Patent: JP 1993105699-A 1 27-APR-1993; 15 | JAPAN FOUND CANCER RES, MEIJI MILK PROD CO LTD 16 | COMMENT OS Artificial gene 17 | OC Artificial sequence; Genes. 18 | PN JP 1993105699-A/1 19 | PD 27-APR-1993 20 | PF 07-AUG-1991 JP 1991198008 21 | PI MORI TAKESHI, TAKADA TOMOKO, KOIKE KATSURO, SUGANO HARUO PC 22 | C07K15/04,A61K39/29,C12N15/51,C12P21/02,G01N33/53,G01N33/569, PC 23 | G01N33/576, 24 | PC (C12P21/02,C12R1:19); 25 | CC strandedness: Double; 26 | CC topology: Linear; 27 | FH Key Location/Qualifiers 28 | FH 29 | FT misc_feature 1..25 30 | FT /note='PCR primer to generate NcoI and SphI 31 | FT site adjacent 32 | FT to T7 promoter on pGEMEX2'. 33 | FEATURES Location/Qualifiers 34 | source 1..25 35 | /organism="synthetic construct" 36 | /mol_type="unassigned DNA" 37 | /db_xref="taxon:32630" 38 | ORIGIN 39 | 1 atatgggtac cgatcgtacg gacca 40 | // 41 | -------------------------------------------------------------------------------- /tests/G.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/G.txt -------------------------------------------------------------------------------- /tests/GUP1rec1sens.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec1sens 2 | gaattcgatatcaagcttatcgataccgatgtcgctgatcagcatcctgtc 3 | -------------------------------------------------------------------------------- /tests/GUP1rec2AS.txt: -------------------------------------------------------------------------------- 1 | >GUP1rec2AS 2 | gacataactaattacatgactcgaggtcgactcagcattttaggtaaattccg 3 | -------------------------------------------------------------------------------- /tests/Ggatcc (copy).gb: -------------------------------------------------------------------------------- 1 | LOCUS name 6 bp DNA circular UNK 01-JUN-2018 2 | DEFINITION cSEGUID_6WVYnCK97MOPMOlbLHvMnd4XIEY_2018-06-01T05:38:38.118326. 3 | ACCESSION id 4 | VERSION id 5 | KEYWORDS . 6 | SOURCE . 7 | ORGANISM . 8 | . 9 | FEATURES Location/Qualifiers 10 | ORIGIN 11 | 1 ggatcc 12 | // 13 | -------------------------------------------------------------------------------- /tests/Ggatcc.gb: -------------------------------------------------------------------------------- 1 | LOCUS name 6 bp DNA circular UNK 01-JUN-2018 2 | DEFINITION description 3 | cSEGUID_6WVYnCK97MOPMOlbLHvMnd4XIEY_2018-06-01T05:38:38.118326. 4 | ACCESSION id 5 | VERSION id 6 | KEYWORDS . 7 | SOURCE . 8 | ORGANISM . 9 | . 10 | FEATURES Location/Qualifiers 11 | ORIGIN 12 | 1 ggatcc 13 | // 14 | -------------------------------------------------------------------------------- /tests/KlLEU2tt.fas: -------------------------------------------------------------------------------- 1 | >Kluyveromyces lactis (heterologous LEU2 tt) Intergenic-KLLA0D04906g-KLLA0D04928g klac_Chr_4 (421992..422548) 557bp 2 | AGAGTCTTTTGTAACGACCCCGTCTCCACCAACTTGGTATGCTTGAAATCTCAAGGCCAT 3 | TACACATTCAGTTATGTGAACGAAAGGTCTTTATTTAACGTAGCATAAACTAAATAATAC 4 | AGGTTCCGGTTAGCCTGCAATGTGTTAAATCTAAAGGAGCATACCCAAAATGAACTGAAG 5 | ACAAGGAAATTTGCTTGTCCAGATGTGATTGAGCATTTGAACGTTAATAACATAACATTT 6 | TTATACTTAACTATAGAAAGACTTGTATAAAAACTGGCAAACGAGATATTCTGAATATTG 7 | GTGCATATTTCAGGTAGAAAAGCTTACAAAACAATCTAATCATAATATTGAGATGAAGAG 8 | AAAGATAAAAGAAAAAACGATAAGTCAGATGAGATTATGATTGTACTTTGAAATCGAGGA 9 | ACAAAGTATATACGGTAGTAGTTCCCCGAGTTATAACGGGAGATCATGTAAATTGAGAAA 10 | CCAGATAAAGATTTGGTATGCACTCTAGCAAGAAAATAAAATGATGAATCTATGATATAG 11 | ATCACTTTTGTTCCAGC 12 | -------------------------------------------------------------------------------- /tests/KlLEU2tt.gb: -------------------------------------------------------------------------------- 1 | LOCUS KlLEU2tt 557 bp ds-DNA linear UNK 24-NOV-2012 2 | DEFINITION . 3 | ACCESSION KlLEU2tt 4 | VERSION KlLEU2tt 5 | KEYWORDS . 6 | SOURCE 7 | ORGANISM . 8 | . 9 | COMMENT >557bp 10 | ApEinfo:methylated:1 11 | pydna ldseguid=P9x63swJk1IpZaAg0ytfL-Bx1Oc 2024-06-11T18:53:23 12 | FEATURES Location/Qualifiers 13 | terminator 1..557 14 | /label="KlLEU2tt" 15 | /ApEinfo_fwdcolor="#f8a669" 16 | /ApEinfo_revcolor="#acffcb" 17 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 18 | width 5 offset 0" 19 | ORIGIN 20 | 1 agagtctttt gtaacgaccc cgtctccacc aacttggtat gcttgaaatc tcaaggccat 21 | 61 tacacattca gttatgtgaa cgaaaggtct ttatttaacg tagcataaac taaataatac 22 | 121 aggttccggt tagcctgcaa tgtgttaaat ctaaaggagc atacccaaaa tgaactgaag 23 | 181 acaaggaaat ttgcttgtcc agatgtgatt gagcatttga acgttaataa cataacattt 24 | 241 ttatacttaa ctatagaaag acttgtataa aaactggcaa acgagatatt ctgaatattg 25 | 301 gtgcatattt caggtagaaa agcttacaaa acaatctaat cataatattg agatgaagag 26 | 361 aaagataaaa gaaaaaacga taagtcagat gagattatga ttgtactttg aaatcgagga 27 | 421 acaaagtata tacggtagta gttccccgag ttataacggg agatcatgta aattgagaaa 28 | 481 ccagataaag atttggtatg cactctagca agaaaataaa atgatgaatc tatgatatag 29 | 541 atcacttttg ttccagc 30 | // 31 | -------------------------------------------------------------------------------- /tests/New_DNA.gb: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 20 bp ds-DNA circular 11-JAN-2018 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT ApEinfo:methylated:1 9 | FEATURES Location/Qualifiers 10 | misc_feature complement(join(4..6,9..12)) 11 | /locus_tag="MyFeature" 12 | /label="MyFeature" 13 | /ApEinfo_label="MyFeature" 14 | /ApEinfo_fwdcolor="cyan" 15 | /ApEinfo_revcolor="green" 16 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 17 | width 5 offset 0" 18 | ORIGIN 19 | 1 Agactatctt tggtcgtctt 20 | // 21 | -------------------------------------------------------------------------------- /tests/New_DNA__________________.gb: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 20 bp ds-DNA circular UNK 11-JAN-2018 2 | DEFINITION . 3 | ACCESSION New_DNA 4 | VERSION New_DNA 5 | KEYWORDS . 6 | SOURCE 7 | ORGANISM . 8 | . 9 | COMMENT 10 | ApEinfo:methylated:1 11 | FEATURES Location/Qualifiers 12 | misc_feature complement(join(4..6,9..12)) 13 | /locus_tag="MyFeature" 14 | /label="MyFeature" 15 | /ApEinfo_label="MyFeature" 16 | /ApEinfo_fwdcolor="cyan" 17 | /ApEinfo_revcolor="green" 18 | /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 19 | width 5 offset 0" 20 | ORIGIN 21 | 1 agactatctt tggtcgtctt 22 | // 23 | -------------------------------------------------------------------------------- /tests/X06035.ape: -------------------------------------------------------------------------------- 1 | LOCUS X06035 319 bp DNA linear SYN 26-JUL-2016 2 | DEFINITION Synthetic lacI gene 5'fragment. 3 | ACCESSION X06035 4 | VERSION X06035.1 5 | KEYWORDS artificial gene; repressor. 6 | SOURCE synthetic construct 7 | ORGANISM synthetic construct 8 | other sequences; artificial sequences. 9 | REFERENCE 1 (bases 1 to 319) 10 | AUTHORS Lehming,N., Sartorius,J., Niemoller,M., Genenger,G., v 11 | Wilcken-Bergmann,B. and Muller-Hill,B. 12 | TITLE The interaction of the recognition helix of lac repressor with lac 13 | operator 14 | JOURNAL EMBO J. 6 (10), 3145-3153 (1987) 15 | PUBMED 2826131 16 | COMMENT Data kindly reviewed (12-Arp-1988) by Mueller-Hill B. 17 | FEATURES Location/Qualifiers 18 | source 1..319 19 | /organism="synthetic construct" 20 | /mol_type="other DNA" 21 | /db_xref="taxon:32630" 22 | /clone="pWB100" 23 | regulatory 27..32 24 | /regulatory_class="promoter" 25 | /note="-35 region" 26 | regulatory 50..55 27 | /regulatory_class="promoter" 28 | /note="-10 region" 29 | precursor_RNA 62..>319 30 | /note="primary transcript" 31 | regulatory 94..98 32 | /regulatory_class="ribosome_binding_site" 33 | /note="pot. ribosome binding site" 34 | CDS 107..>319 35 | /note="unnamed protein product; lacI gene product (71 AA)" 36 | /codon_start=1 37 | /transl_table=11 38 | /protein_id="CAA29430.1" 39 | /translation="MKPVTLYDVAEYAGVSYQTVSRVVNQASHVSAKTREKVEAAMAE 40 | LNYIPNRVAQQLAGKQSLLIGVATSSL" 41 | ORIGIN 42 | 1 ggtaccaatc gagataaaaa atttatttgc tttcaggtac aattcttgat ataatattat 43 | 61 catctaggga actagctttc cggggaattc ataaaggaga tatcatatga aaccggtaac 44 | 121 gttatacgac gtcgctgaat acgccggcgt ttcttaccag accgtttcta gagtggttaa 45 | 181 ccaggcttca catgttagcg ctaaaacccg ggaaaaagtt gaagctgcca tggctgagct 46 | 241 caactacatc ccgaaccgtg ttgcgcagca gctggctggt aaacaaagct tgctgatcgg 47 | 301 tgtcgcgacc tcgagcttg 48 | // 49 | -------------------------------------------------------------------------------- /tests/X60065-100-110.gb: -------------------------------------------------------------------------------- 1 | LOCUS X60065 11 bp mRNA linear MAM 26-JUL-2016 2 | DEFINITION B.bovis beta-2-gpI mRNA for beta-2-glycoprotein I. 3 | ACCESSION X60065 REGION: 100..110 4 | VERSION X60065.1 5 | KEYWORDS beta-2 glycoprotein I. 6 | SOURCE Bos taurus (cattle) 7 | ORGANISM Bos taurus 8 | Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; 9 | Mammalia; Eutheria; Laurasiatheria; Cetartiodactyla; Ruminantia; 10 | Pecora; Bovidae; Bovinae; Bos. 11 | REFERENCE 1 12 | AUTHORS Bendixen,E., Halkier,T., Magnusson,S., Sottrup-Jensen,L. and 13 | Kristensen,T. 14 | TITLE Complete primary structure of bovine beta 2-glycoprotein I: 15 | localization of the disulfide bridges 16 | JOURNAL Biochemistry 31 (14), 3611-3617 (1992) 17 | PUBMED 1567819 18 | REFERENCE 2 (bases 1 to 11) 19 | AUTHORS Kristensen,T. 20 | TITLE Direct Submission 21 | JOURNAL Submitted (11-JUN-1991) T. Kristensen, Dept of Mol Biology, 22 | University of Aarhus, C F Mollers Alle 130, DK-8000 Aarhus C, 23 | DENMARK 24 | FEATURES Location/Qualifiers 25 | source 1..11 26 | /organism="Bos taurus" 27 | /mol_type="mRNA" 28 | /db_xref="taxon:9913" 29 | /clone="pBB2I" 30 | /tissue_type="liver" 31 | gene <1..>11 32 | /gene="beta-2-gpI" 33 | CDS <1..>11 34 | /gene="beta-2-gpI" 35 | /codon_start=1 36 | /product="beta-2-glycoprotein I" 37 | /protein_id="CAA42669.1" 38 | /db_xref="GOA:P17690" 39 | /db_xref="InterPro:IPR000436" 40 | /db_xref="InterPro:IPR015104" 41 | /db_xref="InterPro:IPR016060" 42 | /db_xref="UniProtKB/Swiss-Prot:P17690" 43 | /translation="LKRT" 44 | mat_peptide <1..>11 45 | /product="beta-2-glycoprotein I" 46 | ORIGIN 47 | 1 ctgaaacgga c 48 | // 49 | -------------------------------------------------------------------------------- /tests/XKS1_orf.txt: -------------------------------------------------------------------------------- 1 | >YGR194C Chr 7 2 | ATGTTGTGTTCAGTAATTCAGAGACAGACAAGAGAGGTTTCCAACACAATGTCTTTAGAC 3 | TCATACTATCTTGGGTTTGATCTTTCGACCCAACAACTGAAATGTCTCGCCATTAACCAG 4 | GACCTAAAAATTGTCCATTCAGAAACAGTGGAATTTGAAAAGGATCTTCCGCATTATCAC 5 | ACAAAGAAGGGTGTCTATATACACGGCGACACTATCGAATGTCCCGTAGCCATGTGGTTA 6 | GAGGCTCTAGATCTGGTTCTCTCGAAATATCGCGAGGCTAAATTTCCATTGAACAAAGTT 7 | ATGGCCGTCTCAGGGTCCTGCCAGCAGCACGGGTCTGTCTACTGGTCCTCCCAAGCCGAA 8 | TCTCTGTTAGAGCAATTGAATAAGAAACCGGAAAAAGATTTATTGCACTACGTGAGCTCT 9 | GTAGCATTTGCAAGGCAAACCGCCCCCAATTGGCAAGACCACAGTACTGCAAAGCAATGT 10 | CAAGAGTTTGAAGAGTGCATAGGTGGGCCTGAAAAAATGGCTCAATTAACAGGGTCCAGA 11 | GCCCATTTTAGATTTACTGGTCCTCAAATTCTGAAAATTGCACAATTAGAACCAGAAGCT 12 | TACGAAAAAACAAAGACCATTTCTTTAGTGTCTAATTTTTTGACTTCTATCTTAGTGGGC 13 | CATCTTGTTGAATTAGAGGAGGCAGATGCCTGTGGTATGAACCTTTATGATATACGTGAA 14 | AGAAAATTCAGTGATGAGCTACTACATCTAATTGATAGTTCTTCTAAGGATAAAACTATC 15 | AGACAAAAATTAATGAGAGCACCCATGAAAAATTTGATAGCGGGTACCATCTGTAAATAT 16 | TTTATTGAGAAGTACGGTTTCAATACAAACTGCAAGGTCTCTCCCATGACTGGGGATAAT 17 | TTAGCCACTATATGTTCTTTACCCCTGCGGAAGAATGACGTTCTCGTTTCCCTAGGAACA 18 | AGTACTACAGTTCTTCTGGTCACCGATAAGTATCACCCCTCTCCGAACTATCATCTTTTC 19 | ATTCATCCAACTCTGCCAAACCATTATATGGGTATGATTTGTTATTGTAATGGTTCTTTG 20 | GCAAGGGAGAGGATAAGAGACGAGTTAAACAAAGAACGGGAAAATAATTATGAGAAGACT 21 | AACGATTGGACTCTTTTTAATCAAGCTGTGCTAGATGACTCAGAAAGTAGTGAAAATGAA 22 | TTAGGTGTATATTTTCCTCTGGGGGAGATCGTTCCTAGCGTAAAAGCCATAAACAAAAGG 23 | GTTATCTTCAATCCAAAAACGGGTATGATTGAAAGAGAGGTGGCCAAGTTCAAAGACAAG 24 | AGGCACGATGCCAAAAATATTGTAGAATCACAGGCTTTAAGTTGCAGGGTAAGAATATCT 25 | CCCCTGCTTTCGGATTCAAACGCAAGCTCACAACAGAGACTGAACGAAGATACAATCGTG 26 | AAGTTTGATTACGATGAATCTCCGCTGCGGGACTACCTAAATAAAAGGCCAGAAAGGACT 27 | TTTTTTGTAGGTGGGGCTTCTAAAAACGATGCTATTGTGAAGAAGTTTGCTCAAGTCATT 28 | GGTGCTACAAAGGGTAATTTTAGGCTAGAAACACCAAACTCATGTGCCCTTGGTGGTTGT 29 | TATAAGGCCATGTGGTCATTGTTATATGACTCTAATAAAATTGCAGTTCCTTTTGATAAA 30 | TTTCTGAATGACAATTTTCCATGGCATGTAATGGAAAGCATATCCGATGTGGATAATGAA 31 | AATTGGGATCGCTATAATTCCAAGATTGTCCCCTTAAGCGAACTGGAAAAGACTCTCATC 32 | TAA 33 | -------------------------------------------------------------------------------- /tests/___test_module_myprimers_gdoc.py___: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_drive(monkeypatch): 8 | 9 | from pydrive2.auth import GoogleAuth as _GoogleAuth 10 | from pydrive2.auth import (ServiceAccountCredentials 11 | as _ServiceAccountCredentials) 12 | from pydrive2.drive import GoogleDrive as _GoogleDrive 13 | 14 | from unittest.mock import MagicMock, PropertyMock, seal 15 | 16 | # class mock_GoogleDrive(object): 17 | # def __init__(self, auth=None): 18 | # self.auth = auth 19 | 20 | mock_GA = MagicMock(spec=_GoogleAuth) 21 | mock_GD = MagicMock(spec=_GoogleDrive) 22 | mock_SAC = MagicMock(spec=_ServiceAccountCredentials) 23 | 24 | mock_GA.credentials = "" 25 | 26 | monkeypatch.setattr("pydna.myprimers_gdoc._GoogleAuth", 27 | mock_GA) 28 | monkeypatch.setattr("pydna.myprimers_gdoc._GoogleDrive", 29 | mock_GD) 30 | monkeypatch.setattr("pydna.myprimers_gdoc._ServiceAccountCredentials", 31 | mock_SAC) 32 | 33 | from pydna import myprimers_gdoc 34 | 35 | primerlist = myprimers_gdoc.get_primer_list_from_gdoc() 36 | 37 | mock_GA.assert_called() 38 | assert mock_GA.credentials == "" 39 | 40 | mock_GD.assert_called() 41 | mock_SAC.assert_not_called() 42 | 43 | import os 44 | from pathlib import Path 45 | 46 | pth = Path(os.getenv("pydna_config_dir"))/"service_account.json" 47 | 48 | call = (str(pth), 49 | ['https://www.googleapis.com/auth/drive']) 50 | 51 | mock_SAC.from_json_keyfile_name.assert_called_with(*call) 52 | 53 | 54 | 55 | 56 | if __name__ == "__main__": 57 | pytest.main([__file__, "-vv", "-s"]) 58 | -------------------------------------------------------------------------------- /tests/__getenv.txt: -------------------------------------------------------------------------------- 1 | +--------------------+--------------------------+ 2 | | Variable | Value | 3 | +--------------------+--------------------------+ 4 | | pydna_ape | put/path/to/ape/here | 5 | | pydna_cached_funcs | Genbank_nucleotide | 6 | | pydna_config_dir | /tmp/pydna_test | 7 | | pydna_data_dir | /tmp/pydna_test | 8 | | pydna_email | someone@example.com | 9 | | pydna_enzymes | put/path/to/enzymes/here | 10 | | pydna_log_dir | /tmp/pydna_test | 11 | | pydna_loglevel | 30 | 12 | | pydna_primers | put/path/to/primers/here | 13 | +--------------------+--------------------------+ 14 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pathlib 3 | import os 4 | 5 | cwd = pathlib.Path(__file__).parent 6 | 7 | # def pytest_runtest_setup(item): 8 | # # called for running each test in 'a' directory 9 | # #os.chdir(cwd) 10 | # pass 11 | 12 | 13 | def pytest_configure(config): 14 | """ 15 | Allows plugins and conftest files to perform initial configuration. 16 | This hook is called for every plugin and initial conftest 17 | file after command line options have been parsed. 18 | """ 19 | os.chdir(cwd) 20 | print(f"cwd set to {cwd} in {__file__}") 21 | 22 | 23 | # def pytest_sessionstart(session): 24 | # """ 25 | # Called after the Session object has been created and 26 | # before performing collection and entering the run test loop. 27 | # """ 28 | 29 | 30 | # def pytest_sessionfinish(session, exitstatus): 31 | # """ 32 | # Called after whole test run finished, right before 33 | # returning the exit status to the system. 34 | # """ 35 | 36 | 37 | # def pytest_unconfigure(config): 38 | # """ 39 | # called before test process is exited. 40 | # """ 41 | -------------------------------------------------------------------------------- /tests/dna2943.gb: -------------------------------------------------------------------------------- 1 | LOCUS dna2943._Coding_seq_of_ 1495 bp ds-DNA linear UNK 03-JUN-2022 2 | DEFINITION . 3 | ACCESSION dna2943._Coding_seq_of_ 4 | VERSION dna2943._Coding_seq_of_ 5 | KEYWORDS "creator:synthetic biology". 6 | SOURCE 7 | ORGANISM . 8 | . 9 | COMMENT pydna ldseguid=ScLoSddUf2c0GIAGpvIi33nLvFY 2024-06-11T18:43:13 10 | FEATURES Location/Qualifiers 11 | misc_feature 13..16 12 | /label="overhang 3" 13 | /ApEinfo_revcolor="#b4abac" 14 | /ApEinfo_fwdcolor="#b4abac" 15 | CDS 13..37 16 | /label="linker3 (GGGGS)4" 17 | /ApEinfo_revcolor="#85dae9" 18 | /ApEinfo_fwdcolor="#85dae9" 19 | CDS 38..1468 20 | /label="luxC" 21 | /ApEinfo_revcolor="#993366" 22 | /ApEinfo_fwdcolor="#993366" 23 | ORIGIN 24 | 1 atcggaagac aacggaggta gtggtggcgg aggtagtatg gaaaagcatt tgcccttgat 25 | 61 tatcaatggt ctgatttgct ctacggggcg cggtagtcat gagatcactt ttgaagaaaa 26 | 121 taaagttaaa atcgatgctt tcaatgttga gcatgtttct cagatgctta gtcaggattt 27 | 181 tttgattgat ctggatatta ataacattgt taattttctg tatgcagtgg gacaacgctg 28 | 241 gaagaatgaa gagtattctc gccgccgcac gtacattcgc aacctgatta cctacttggg 29 | 301 ttattcacca caaatggcaa aattggaggc caattggatc gcaatgattc tgtgctctaa 30 | 361 aagtgccctg tatgacattg tgaatactga gcttgggtca acgcatattc aagatgagtg 31 | 421 gcttccgcaa ggggagtgtt atgtacgcgc attccctaaa gggcgcgtca tgcacctgtt 32 | 481 ggcaggtaat gttccccttt ccggtgtgac atcaatcttg cgcggcattc tgactaaaaa 33 | 541 tcaatgcatc gtacgcatga gcgcttccga tccatttact gcgcatgcat tggcaatgag 34 | 601 ttttattgac gtcaatccgg accacccaat ttctaagagc atctctgtac tgtattggcc 35 | 661 acataaagct gatacgacaa ttgcggagga gctgattagt catatggatg cggttgttgc 36 | 721 ttggggaggg catgatgcta ttgattgggc ggttaagcat tccccttcac atattgatgt 37 | 781 tttgaagttc ggccctaaaa aaagttttac tattctggat gaaccgacca acttggatga 38 | 841 agcggcttcc ggcgccgctc atgatatttg cttctatgac cagaatgctt gtttctctac 39 | 901 ccagaatatc tacttttgtg gagataacta cgaagctttt aaggataagt tggtagaaaa 40 | 961 actgtgtctt tatgaaaata ttcttccgaa gtctcgccaa agttttgatg aagaagcttt 41 | 1021 gttttcattt actcgcttgg aatgtcaatt ctcaggtctt aacattatct ccgaaccaaa 42 | 1081 taataagtgg atgattattg aatcagacgc tggtgtcgaa tacaaccacc ctctcagtcg 43 | 1141 ctgtgtctat atccataaaa ttaataaggt ggaagatgtt gttgattata tcgacaagca 44 | 1201 taaaactcaa acgatttctt tttatccttg gagttcttca actaaatacc gcgatatctt 45 | 1261 tgctcaaaaa ggcgttgagc gcattgttga atccggcatg aataatatct ttcgcgcggg 46 | 1321 tggtgcacat gatgccatgc gcccactgca acgcctggtt cgctttgtct ctcacgaacg 47 | 1381 cccatatagt ttcaccacca aggatgtctc tgttgaaatt gaacaaactc gctttcttga 48 | 1441 agaagataag ttcttggttt ttgtccctta atgaagagca ggttagtctt cattc 49 | // 50 | -------------------------------------------------------------------------------- /tests/dna2943_mod.gb: -------------------------------------------------------------------------------- 1 | LOCUS name 1495 bp DNA linear UNK 01-JAN-1980 2 | DEFINITION description. 3 | ACCESSION id 4 | VERSION id 5 | KEYWORDS . 6 | SOURCE 7 | ORGANISM . 8 | . 9 | COMMENT pydna ldseguid=ScLoSddUf2c0GIAGpvIi33nLvFY 2024-06-11T18:40:49 10 | FEATURES Location/Qualifiers 11 | ORIGIN 12 | 1 atcggaagac aacggaggta gtggtggcgg aggtagtatg gaaaagcatt tgcccttgat 13 | 61 tatcaatggt ctgatttgct ctacggggcg cggtagtcat gagatcactt ttgaagaaaa 14 | 121 taaagttaaa atcgatgctt tcaatgttga gcatgtttct cagatgctta gtcaggattt 15 | 181 tttgattgat ctggatatta ataacattgt taattttctg tatgcagtgg gacaacgctg 16 | 241 gaagaatgaa gagtattctc gccgccgcac gtacattcgc aacctgatta cctacttggg 17 | 301 ttattcacca caaatggcaa aattggaggc caattggatc gcaatgattc tgtgctctaa 18 | 361 aagtgccctg tatgacattg tgaatactga gcttgggtca acgcatattc aagatgagtg 19 | 421 gcttccgcaa ggggagtgtt atgtacgcgc attccctaaa gggcgcgtca tgcacctgtt 20 | 481 ggcaggtaat gttccccttt ccggtgtgac atcaatcttg cgcggcattc tgactaaaaa 21 | 541 tcaatgcatc gtacgcatga gcgcttccga tccatttact gcgcatgcat tggcaatgag 22 | 601 ttttattgac gtcaatccgg accacccaat ttctaagagc atctctgtac tgtattggcc 23 | 661 acataaagct gatacgacaa ttgcggagga gctgattagt catatggatg cggttgttgc 24 | 721 ttggggaggg catgatgcta ttgattgggc ggttaagcat tccccttcac atattgatgt 25 | 781 tttgaagttc ggccctaaaa aaagttttac tattctggat gaaccgacca acttggatga 26 | 841 agcggcttcc ggcgccgctc atgatatttg cttctatgac cagaatgctt gtttctctac 27 | 901 ccagaatatc tacttttgtg gagataacta cgaagctttt aaggataagt tggtagaaaa 28 | 961 actgtgtctt tatgaaaata ttcttccgaa gtctcgccaa agttttgatg aagaagcttt 29 | 1021 gttttcattt actcgcttgg aatgtcaatt ctcaggtctt aacattatct ccgaaccaaa 30 | 1081 taataagtgg atgattattg aatcagacgc tggtgtcgaa tacaaccacc ctctcagtcg 31 | 1141 ctgtgtctat atccataaaa ttaataaggt ggaagatgtt gttgattata tcgacaagca 32 | 1201 taaaactcaa acgatttctt tttatccttg gagttcttca actaaatacc gcgatatctt 33 | 1261 tgctcaaaaa ggcgttgagc gcattgttga atccggcatg aataatatct ttcgcgcggg 34 | 1321 tggtgcacat gatgccatgc gcccactgca acgcctggtt cgctttgtct ctcacgaacg 35 | 1381 cccatatagt ttcaccacca aggatgtctc tgttgaaatt gaacaaactc gctttcttga 36 | 1441 agaagataag ttcttggttt ttgtccctta atgaagagca ggttagtctt cattc 37 | // 38 | -------------------------------------------------------------------------------- /tests/figures.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/figures.odt -------------------------------------------------------------------------------- /tests/foo: -------------------------------------------------------------------------------- 1 | some stuff 2 | -------------------------------------------------------------------------------- /tests/myseq.gb: -------------------------------------------------------------------------------- 1 | LOCUS myseq 33 bp DNA UNK 01-JAN-1980 2 | DEFINITION .. 3 | ACCESSION myseq 4 | VERSION myseq 5 | KEYWORDS . 6 | SOURCE . 7 | ORGANISM . 8 | . 9 | FEATURES Location/Qualifiers 10 | misc join(11..20,26..29) 11 | /note="MyFeature" 12 | ORIGIN 13 | 1 gagtgtgaag acacaaccgg caagtgacga cgg 14 | // 15 | -------------------------------------------------------------------------------- /tests/output.file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/output.file -------------------------------------------------------------------------------- /tests/pCAPs_fasta.txt: -------------------------------------------------------------------------------- 1 | >pCAPs 2 | tcgcgcgtttcggtgatgacggtgaaaacctctgacacatgcagctcccggagacggtcacagcttgtctgtaagcggatgccgggagcagacaagcccgtcagggcgcgtcagcgggtgttggcgggtgtcggggctggcttaactatgcggcatcagagcagattgtactgagagtgcaccatagatcctgaggatcggggtgataaatcagtctgcgccacatcgggggaaacaaaatggcgcgagatctaaaaaaaaaggctccaaaaggagcctttcgcgctaccaggtaacgcgccactccgacgggattaacgagtgccgtaaacgacgatggttttaccgtgtgcggagatcaggttctgatcctcgagcatcttaagaattcgtcccacggtttgtctagagcagccgacaatctggccaatttcctgacgggtaattttgatttgcatgccgtccgggtgagtcatagcgtctggttgttttgccagattcagcagagtctgtgcaatgcggccgctgacgtcgaggaacgccaggttgcccactttctcactagtgacctgcagccggcgcgccatctgtgcagacaaacgcatcaggatatccggatttacctgaatcaattggcgaaattttttgtacgaaatttcagccacttcacaggcggttttcgcacgtacccatgcgctacgttcctggccctcttcaaacaggcccagttcgccaataaaatcaccctgattcagataggagaggatcatttctttaccctcttcgtctttgatcagcactgccacagagcctttaacgatgtagtacagcgtttccgctttttcaccctggtgaataagcgtgctcttggatgggtacttatgaatgtggcaatgagacaagaaccattcgagagtaggatccgtttgaggtttaccaagtaccataagatccttaaatttttattatctagctagatgataatattatatcaagaattgtacctgaaagcaaataaattttttatctggcttaactatgcggcatcagagcagattgtactgagagtgcaccatatgcggtgtgaaataccgcacagatgcgtaaggagaaaataccgcatcaggcgctcttccgcttcctcgctcactgactcgctgcgctcggtcgttcggctgcggcgagcggtatcagctcactcaaaggcggtaatacggttatccacagaatcaggggataacgcaggaaagaacatgtgagcaaaaggccagcaaaaggccaggaaccgtaaaaaggccgcgttgctggcgtttttccataggctccgcccccctgacgagcatcacaaaaatcgacgctcaagtcagaggtggcgaaacccgacaggactataaagataccaggcgtttccccctggaagctccctcgtgcgctctcctgttccgaccctgccgcttaccggatacctgtccgcctttctcccttcgggaagcgtggcgctttctcatagctcacgctgtaggtatctcagttcggtgtaggtcgttcgctccaagctgggctgtgtgcacgaaccccccgttcagcccgaccgctgcgccttatccggtaactatcgtcttgagtccaacccggtaagacacgacttatcgccactggcagcagccactggtaacaggattagcagagcgaggtatgtaggcggtgctacagagttcttgaagtggtggcctaactacggctacactagaaggacagtatttggtatctgcgctctgctgaagccagttaccttcggaaaaagagttggtagctcttgatccggcaaacaaaccaccgctggtagcggtggtttttttgtttgcaagcagcagattacgcgcagaaaaaaaggatctcaagaagatcctttgatcttttctacggggtctgacgctcagtggaacgaaaactcacgttaagggattttggtcatgagattatcaaaaaggatcttcacctagatccttttaaattaaaaatgaagttttaaatcaatctaaagtatatatgagtaaacttggtctgacagttaccaatgcttaatcagtgaggcacctatctcagcgatctgtctatttcgttcatccatagttgcctgactccccgtcgtgtagataactacgatacgggagggcttaccatctggccccagtgctgcaatgataccgcgagacccacgctcaccggctccagatttatcagcaataaaccagccagccggaagggccgagcgcagaagtggtcctgcaactttatccgcctccatccagtctattaattgttgccgggaagctagagtaagtagttcgccagttaatagtttgcgcaacgttgttgccattgctacaggcatcgtggtgtcacgctcgtcgtttggtatggcttcattcagctccggttcccaacgatcaaggcgagttacatgatcccccatgttgtgcaaaaaagcggttagctccttcggtcctccgatcgttgtcagaagtaagttggccgcagtgttatcactcatggttatggcagcactgcataattctcttactgtcatgccatccgtaagatgcttttctgtgactggtgagtactcaaccaagtcattctgagaatagtgtatgcggcgaccgagttgctcttgcccggcgtcaatacgggataataccgcgccacatagcagaactttaaaagtgctcatcattggaaaacgttcttcggggcgaaaactctcaaggatcttaccgctgttgagatccagttcgatgtaacccactcgtgcacccaactgatcttcagcatcttttactttcaccagcgtttctgggtgagcaaaaacaggaaggcaaaatgccgcaaaaaagggaataagggcgacacggaaatgttgaatactcatactcttcctttttcaatattattgaagcatttatcagggttattgtctcatgagcggatacatatttgaatgtatttagaaaaataaacaaataggggttccgcgcacatttccccgaaaagtgccacctgctaagaaaccattattatcatgacattaacctataaaaataggcgtatcacgaggccctttcgtc 3 | -------------------------------------------------------------------------------- /tests/pUC19_fasta.txt: -------------------------------------------------------------------------------- 1 | >pUC19 2 | tcgcgcgtttcggtgatgacggtgaaaacctctgacacatgcagctcccggagacggtcacagcttgtctgtaagcggatgccgggagcagacaagcccgtcagggcgcgtcagcgggtgttggcgggtgtcggggctggcttaactatgcggcatcagagcagattgtactgagagtgcaccatatgcggtgtgaaataccgcacagatgcgtaaggagaaaataccgcatcaggcgccattcgccattcaggctgcgcaactgttgggaagggcgatcggtgcgggcctcttcgctattacgccagctggcgaaagggggatgtgctgcaaggcgattaagttgggtaacgccagggttttcccagtcacgacgttgtaaaacgacggccagtgaattcgagctcggtacccggggatcctctagagtcgacctgcaggcatgcaagcttggcgtaatcatggtcatagctgtttcctgtgtgaaattgttatccgctcacaattccacacaacatacgagccggaagcataaagtgtaaagcctggggtgcctaatgagtgagctaactcacattaattgcgttgcgctcactgcccgctttccagtcgggaaacctgtcgtgccagctgcattaatgaatcggccaacgcgcggggagaggcggtttgcgtattgggcgctcttccgcttcctcgctcactgactcgctgcgctcggtcgttcggctgcggcgagcggtatcagctcactcaaaggcggtaatacggttatccacagaatcaggggataacgcaggaaagaacatgtgagcaaaaggccagcaaaaggccaggaaccgtaaaaaggccgcgttgctggcgtttttccataggctccgcccccctgacgagcatcacaaaaatcgacgctcaagtcagaggtggcgaaacccgacaggactataaagataccaggcgtttccccctggaagctccctcgtgcgctctcctgttccgaccctgccgcttaccggatacctgtccgcctttctcccttcgggaagcgtggcgctttctcatagctcacgctgtaggtatctcagttcggtgtaggtcgttcgctccaagctgggctgtgtgcacgaaccccccgttcagcccgaccgctgcgccttatccggtaactatcgtcttgagtccaacccggtaagacacgacttatcgccactggcagcagccactggtaacaggattagcagagcgaggtatgtaggcggtgctacagagttcttgaagtggtggcctaactacggctacactagaagaacagtatttggtatctgcgctctgctgaagccagttaccttcggaaaaagagttggtagctcttgatccggcaaacaaaccaccgctggtagcggtggtttttttgtttgcaagcagcagattacgcgcagaaaaaaaggatctcaagaagatcctttgatcttttctacggggtctgacgctcagtggaacgaaaactcacgttaagggattttggtcatgagattatcaaaaaggatcttcacctagatccttttaaattaaaaatgaagttttaaatcaatctaaagtatatatgagtaaacttggtctgacagttaccaatgcttaatcagtgaggcacctatctcagcgatctgtctatttcgttcatccatagttgcctgactccccgtcgtgtagataactacgatacgggagggcttaccatctggccccagtgctgcaatgataccgcgagacccacgctcaccggctccagatttatcagcaataaaccagccagccggaagggccgagcgcagaagtggtcctgcaactttatccgcctccatccagtctattaattgttgccgggaagctagagtaagtagttcgccagttaatagtttgcgcaacgttgttgccattgctacaggcatcgtggtgtcacgctcgtcgtttggtatggcttcattcagctccggttcccaacgatcaaggcgagttacatgatcccccatgttgtgcaaaaaagcggttagctccttcggtcctccgatcgttgtcagaagtaagttggccgcagtgttatcactcatggttatggcagcactgcataattctcttactgtcatgccatccgtaagatgcttttctgtgactggtgagtactcaaccaagtcattctgagaatagtgtatgcggcgaccgagttgctcttgcccggcgtcaatacgggataataccgcgccacatagcagaactttaaaagtgctcatcattggaaaacgttcttcggggcgaaaactctcaaggatcttaccgctgttgagatccagttcgatgtaacccactcgtgcacccaactgatcttcagcatcttttactttcaccagcgtttctgggtgagcaaaaacaggaaggcaaaatgccgcaaaaaagggaataagggcgacacggaaatgttgaatactcatactcttcctttttcaatattattgaagcatttatcagggttattgtctcatgagcggatacatatttgaatgtatttagaaaaataaacaaataggggttccgcgcacatttccccgaaaagtgccacctgacgtctaagaaaccattattatcatgacattaacctataaaaataggcgtatcacgaggccctttcgtc 3 | -------------------------------------------------------------------------------- /tests/primer1.txt: -------------------------------------------------------------------------------- 1 | >primer1 2 | GCGGATCCTCTAGAATGGTTTGTTCAGTAATTCAG 3 | -------------------------------------------------------------------------------- /tests/primer3.txt: -------------------------------------------------------------------------------- 1 | >primer3 2 | AGATCTGGATCCTTAGATGAGAGTCTTTTCCAG 3 | -------------------------------------------------------------------------------- /tests/primers_linux_line_endings.txt: -------------------------------------------------------------------------------- 1 | >3_primer 2 | aaaaaaaa 3 | 4 | >2_primer 5 | cccccccc 6 | 7 | >1_primer 8 | gggggggg 9 | 10 | >0_primer 11 | tttttttt 12 | -------------------------------------------------------------------------------- /tests/primers_linux_line_endings_not_unique.txt: -------------------------------------------------------------------------------- 1 | # Comment 2 | # Another comment 3 | 4 | >6_primer 5 | atatatat 6 | 7 | >4_primer 8 | aaaaaaaa 9 | 10 | >3_primer 11 | gggggggg 12 | 13 | >2_primer 14 | nnn 15 | 16 | >1_primer 17 | gggggggg 18 | 19 | >0_primer 20 | tttttttt 21 | -------------------------------------------------------------------------------- /tests/profile.pstat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/profile.pstat -------------------------------------------------------------------------------- /tests/pth2.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/pth2.txt -------------------------------------------------------------------------------- /tests/pthx.txt: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 6 bp ds-DNA linear 14-MAR-2015 2 | DEFINITION oooo 3 | ACCESSION 4 | VERSION 5 | SOURCE oooo 6 | ORGANISM oooo 7 | COMMENT oooo 8 | COMMENT ApEinfo:methylated:1 9 | FEATURES Location/Qualifiers 10 | misc_feature 3..4 11 | /label=µ 12 | /ApEinfo_fwdcolor=cyan 13 | /ApEinfo_revcolor=green 14 | /ApEinfo_graphicformat=arrow_data {{0 1 2 0 0 -1} {} 0} 15 | width 5 offset 0 16 | ORIGIN 17 | 1 aaaaaa 18 | // 19 | -------------------------------------------------------------------------------- /tests/pydna_gel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/pydna_gel.png -------------------------------------------------------------------------------- /tests/pydna_gel2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pydna-group/pydna/ff92d1978547f61644e7289c5b9ec34ec3f186b2/tests/pydna_gel2.png -------------------------------------------------------------------------------- /tests/pydna_read_test.txt: -------------------------------------------------------------------------------- 1 | LOCUS pydna_read_test 3 bp ds-DNA linear 16-APR-2015 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT 9 | COMMENT ApEinfo:methylated:1 10 | FEATURES Location/Qualifiers 11 | misc_feature 2..2 12 | /label=2micron 2µ 13 | /ApEinfo_fwdcolor=cyan 14 | /ApEinfo_revcolor=green 15 | /ApEinfo_graphicformat=arrow_data {{0 1 2 0 0 -1} {} 0} 16 | width 5 offset 0 17 | ORIGIN 18 | 1 aaa 19 | // 20 | -------------------------------------------------------------------------------- /tests/read1.gb: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 4 bp ds-DNA linear 30-MAR-2013 2 | DEFINITION . 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT ApEinfo:methylated:1 9 | FEATURES Location/Qualifiers 10 | misc_feature 2..3 11 | /label=NewFeature 12 | /ApEinfo_fwdcolor=cyan 13 | /ApEinfo_revcolor=green 14 | /ApEinfo_graphicformat=arrow_data {{0 1 2 0 0 -1} {} 0} 15 | width 5 offset 0 16 | ORIGIN 17 | 1 acgt 18 | // 19 | -------------------------------------------------------------------------------- /tests/read2.gb: -------------------------------------------------------------------------------- 1 | LOCUS New_DNA 4 bp ds-DNA linear 30-MAR-2013 2 | DEFINITION öööh! 3 | ACCESSION 4 | VERSION 5 | SOURCE . 6 | ORGANISM . 7 | COMMENT 8 | COMMENT ApEinfo:methylated:1 9 | FEATURES Location/Qualifiers 10 | misc_feature 2..3 11 | /label=NewFeature 12 | /ApEinfo_fwdcolor=cyan 13 | /ApEinfo_revcolor=green 14 | /ApEinfo_graphicformat=arrow_data {{0 1 2 0 0 -1} {} 0} 15 | width 5 offset 0 16 | ORIGIN 17 | 1 acgt 18 | // 19 | -------------------------------------------------------------------------------- /tests/read3.fasta: -------------------------------------------------------------------------------- 1 | >hej 2 | acgt 3 | -------------------------------------------------------------------------------- /tests/read4.fasta: -------------------------------------------------------------------------------- 1 | >hej öööh! 2 | acgt 3 | -------------------------------------------------------------------------------- /tests/run_assembly_tests.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | source /home/bjorn/anaconda3/bin/activate bjorn36 3 | python --version # example way to see that your virtual env loaded 4 | git branch 5 | pytest . -vv -s --durations=10 -k test_module_ass 6 | echo "press any key to close" 7 | read -n1 slask 8 | -------------------------------------------------------------------------------- /tests/run_pytest_with_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | pytest . -v -s --cov=pydna --cov-report=html --cov-report=xml #(in tests folder) 3 | # coverage run -m py.test && coverage html #(in tests folder) 4 | read 5 | -------------------------------------------------------------------------------- /tests/sequence.gb: -------------------------------------------------------------------------------- 1 | LOCUS E05006 25 bp DNA linear PAT 04-NOV-2005 2 | DEFINITION PCR primer to generate NcoI and SphI site adjacent to T7 promoter 3 | on pGEMEX2. 4 | ACCESSION E05006 5 | VERSION E05006.1 6 | KEYWORDS JP 1993105699-A/1. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 (bases 1 to 25) 11 | AUTHORS Mori,T., Takada,T., Koike,K. and Sugano,H. 12 | TITLE PRODUCTION OF B TYPE HEPATITIS VIRUS X PROTEIN AND DIAGNOSTIC AGENT 13 | USING THE SAME 14 | JOURNAL Patent: JP 1993105699-A 1 27-APR-1993; 15 | JAPAN FOUND CANCER RES, MEIJI MILK PROD CO LTD 16 | COMMENT OS Artificial gene 17 | OC Artificial sequence; Genes. 18 | PN JP 1993105699-A/1 19 | PD 27-APR-1993 20 | PF 07-AUG-1991 JP 1991198008 21 | PI MORI TAKESHI, TAKADA TOMOKO, KOIKE KATSURO, SUGANO HARUO PC 22 | C07K15/04,A61K39/29,C12N15/51,C12P21/02,G01N33/53,G01N33/569, PC 23 | G01N33/576, 24 | PC (C12P21/02,C12R1:19); 25 | CC strandedness: Double; 26 | CC topology: Linear; 27 | FH Key Location/Qualifiers 28 | FH 29 | FT misc_feature 1..25 30 | FT /note='PCR primer to generate NcoI and SphI 31 | FT site adjacent 32 | FT to T7 promoter on pGEMEX2'. 33 | FEATURES Location/Qualifiers 34 | source 1..25 35 | /organism="synthetic construct" 36 | /mol_type="unassigned DNA" 37 | /db_xref="taxon:32630" 38 | ORIGIN 39 | 1 atatgggtac cgatcgtacg gacca 40 | // 41 | -------------------------------------------------------------------------------- /tests/subfolder/sequence.gb: -------------------------------------------------------------------------------- 1 | LOCUS E05006 25 bp DNA linear PAT 04-NOV-2005 2 | DEFINITION PCR primer to generate NcoI and SphI site adjacent to T7 promoter 3 | on pGEMEX2. 4 | ACCESSION E05006 5 | VERSION E05006.1 6 | KEYWORDS JP 1993105699-A/1. 7 | SOURCE synthetic construct 8 | ORGANISM synthetic construct 9 | other sequences; artificial sequences. 10 | REFERENCE 1 (bases 1 to 25) 11 | AUTHORS Mori,T., Takada,T., Koike,K. and Sugano,H. 12 | TITLE PRODUCTION OF B TYPE HEPATITIS VIRUS X PROTEIN AND DIAGNOSTIC AGENT 13 | USING THE SAME 14 | JOURNAL Patent: JP 1993105699-A 1 27-APR-1993; 15 | JAPAN FOUND CANCER RES, MEIJI MILK PROD CO LTD 16 | COMMENT OS Artificial gene 17 | OC Artificial sequence; Genes. 18 | PN JP 1993105699-A/1 19 | PD 27-APR-1993 20 | PF 07-AUG-1991 JP 1991198008 21 | PI MORI TAKESHI, TAKADA TOMOKO, KOIKE KATSURO, SUGANO HARUO PC 22 | C07K15/04,A61K39/29,C12N15/51,C12P21/02,G01N33/53,G01N33/569, PC 23 | G01N33/576, 24 | PC (C12P21/02,C12R1:19); 25 | CC strandedness: Double; 26 | CC topology: Linear; 27 | FH Key Location/Qualifiers 28 | FH 29 | FT misc_feature 1..25 30 | FT /note='PCR primer to generate NcoI and SphI 31 | FT site adjacent 32 | FT to T7 promoter on pGEMEX2'. 33 | FEATURES Location/Qualifiers 34 | source 1..25 35 | /organism="synthetic construct" 36 | /mol_type="unassigned DNA" 37 | /db_xref="taxon:32630" 38 | ORIGIN 39 | 1 atatgggtac cgatcgtacg gacca 40 | // 41 | -------------------------------------------------------------------------------- /tests/test: -------------------------------------------------------------------------------- 1 | 䔀 blah blah blah 2 | -------------------------------------------------------------------------------- /tests/test_USERcloning.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | from pydna.parsers import parse, parse_primers 6 | from pydna.amplify import pcr 7 | 8 | 9 | def test_USER_cloning(): 10 | 11 | primers = """ 12 | >3CYC1clon 13 | CGAUGTCGACTTAGATCTCACAGGCTTTTTTCAAG 14 | 15 | >5CYC1clone 16 | GAUCGGCCGGATCCAAATGACTGAATTCAAGGCC 17 | """ 18 | template = """ 19 | >templ 20 | CgATGTCGACTTAGATCTCACAGGCTTTTTTCAAGaCGGCCTTGAATTCAGTCATTTGGATCCGGCCGAtC 21 | """ 22 | fp, rp = parse_primers(primers) 23 | te, *rest = parse(template) 24 | te.add_feature() 25 | p = pcr((fp, rp, te)) 26 | 27 | figure = p.figure() 28 | 29 | correct_figure = """\ 30 | 5CgATGTCGACTTAGATCTCACAGGCTTTTTTCAAG...GGCCTTGAATTCAGTCATTTGGATCCGGCCGAtC3 31 | |||||||||||||||||||||||||||||||||| 32 | 3CCGGAACTTAAGTCAGTAAACCTAGGCCGGCUAG5 33 | 5CGAUGTCGACTTAGATCTCACAGGCTTTTTTCAAG3 34 | ||||||||||||||||||||||||||||||||||| 35 | 3GcTACAGCTGAATCTAGAGTGTCCGAAAAAAGTTC...CCGGAACTTAAGTCAGTAAACCTAGGCCGGCTaG5""" 36 | 37 | assert figure == correct_figure 38 | 39 | assert p.seq.watson == "CGAUGTCGACTTAGATCTCACAGGCTTTTTTCAAGaCGGCCTTGAATTCAGTCATTTGGATCCGGCCGATC" 40 | assert p.seq.crick == "GAUCGGCCGGATCCAAATGACTGAATTCAAGGCCGtCTTGAAAAAAGCCTGTGAGATCTAAGTCGACATCG" 41 | 42 | 43 | # hej = p.seq 44 | 45 | # from Bio.SeqFeature import SeqFeature 46 | # import re 47 | 48 | # wpos = [0] + [m.start() for m in re.finditer('U', hej.watson)] + [len(hej.watson)] 49 | # cpos = [0] + [m.start() for m in re.finditer('U', hej.crick)] + [len(hej.crick)] 50 | 51 | # from itertools import tee 52 | 53 | 54 | # def pairwise(iterable): 55 | # "s -> (s0,s1), (s1,s2), (s2, s3), ..." 56 | # a, b = tee(iterable) 57 | # next(b, None) 58 | # return list(slice(x, y, 1) for x, y in zip(a, b)) 59 | 60 | 61 | # wslices = pairwise(wpos) 62 | # cslices = pairwise(cpos) 63 | 64 | # ln = len(hej) 65 | # for ws in wslices: 66 | # for cs in cslices: 67 | # if ws.stop >= ln - cs.stop: 68 | # pass 69 | # # print(ws, cs) 70 | # print(ws, cs) 71 | 72 | if __name__ == "__main__": 73 | pytest.main([__file__, "-vv", "-s"]) 74 | -------------------------------------------------------------------------------- /tests/test_extra_cut_features.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """ 4 | test cut 5 | """ 6 | import pytest 7 | 8 | 9 | def test_cut_feat(): 10 | from pydna.readers import read 11 | from pydna.amplify import pcr 12 | 13 | from pydna.design import primer_design 14 | from pydna.dseqrecord import Dseqrecord 15 | 16 | from Bio.Restriction import EcoRI 17 | 18 | puc19 = read("pUC19_MarkBudde.gb") 19 | assert len(puc19.features) == 19 20 | puc_lin = puc19[:] 21 | assert len(puc_lin.features) == 19 22 | ampl = primer_design(puc_lin) 23 | pf, pr = ampl.forward_primer, ampl.reverse_primer 24 | pcrProd = pcr(pf, pr, puc19) 25 | assert len(pcrProd.features) == 21 26 | assert len(pcrProd.cut(EcoRI)[1].features) == 16 27 | 28 | def amplicon_to_dseqrecord(a): 29 | d = Dseqrecord(a.seq) 30 | d.features = a.features 31 | return d 32 | 33 | pcrProdDseqrecord = amplicon_to_dseqrecord(pcrProd) 34 | assert len(pcrProdDseqrecord.cut(EcoRI)[1].features) == 16 35 | 36 | 37 | if __name__ == "__main__": 38 | pytest.cmdline.main([__file__, "-v", "-s"]) 39 | -------------------------------------------------------------------------------- /tests/test_extra_markbudde.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | import sys 6 | 7 | from pydna.readers import read 8 | 9 | 10 | def test_mark_budde(): 11 | """test mark budde""" 12 | a = read("pGREG505.gb") 13 | assert a.name == "pGREG505" 14 | assert a.looped().name == "pGREG505" 15 | # assert a.annotations == "pGREG505" 16 | assert a.id == "pGREG505" 17 | assert a.looped().id == "pGREG505" 18 | 19 | """ 20 | >>> a = pydna.read('pGREG505.gb') 21 | >>> a.name 22 | 'pGREG505' 23 | >>> a.looped().name 24 | 'pGREG505' 25 | >>> a.annotations 26 | {'comment': 'XYZZYApEinfo:methylated:1', 'source': '', 'taxonomy': [], 'keywords': [''], 'accessions': ['pGREG505'], 'data_file_division': ' ', 'date': '15-DEC-2012', 'organism': '. .'} 27 | >>> a.id 28 | 'pGREG505' 29 | >>> a.looped().id 30 | 'pGREG505' 31 | >>> 32 | """ 33 | 34 | 35 | if __name__ == "__main__": 36 | pytest.cmdline.main([__file__, "-v", "-s"]) 37 | -------------------------------------------------------------------------------- /tests/test_extra_santirdnd_bug_spanning_features.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | """ 4 | test parse 5 | """ 6 | 7 | import pytest 8 | from pydna.readers import read 9 | 10 | 11 | def test_spanning_features(): 12 | pass 13 | 14 | 15 | # temp = ''' 16 | # 17 | # LOCUS MyTemplate 48 bp ds-DNA circular 04-MAY-2017 18 | # DEFINITION . 19 | # ACCESSION MyTemplate 20 | # VERSION MyTemplate 21 | # KEYWORDS . 22 | # SOURCE 23 | # ORGANISM . . 24 | # COMMENT 25 | # COMMENT ApEinfo:methylated:1 26 | # FEATURES Location/Qualifiers 27 | # gene join(34..48,1..12) 28 | # /label=New Feature 29 | # /ApEinfo_fwdcolor="cyan" 30 | # /ApEinfo_revcolor="green" 31 | # /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 32 | # width 5 offset 0" 33 | # ORIGIN 34 | # 1 gctactacac acgtactgac tgcctccaag atagagtcag taaccaca 35 | # // 36 | # 37 | # ''' 38 | # 39 | # # feature is 40 | # # gagtcagtaaccacagctactacacac 41 | # 42 | # tmp = read(temp) 43 | # 44 | # new_feature = tmp.features[0] 45 | # 46 | # assert str(new_feature.extract(tmp).seq) == "GAGTCAGTAACCACAGCTACTACACAC" 47 | # 48 | # new_feature.location.parts[0] 49 | # 50 | # new_feature.location.parts[1] 51 | # 52 | # x=tmp._multiply_circular(2) 53 | # 54 | # assert str(x.features[0].extract(x).seq) == "GAGTCAGTAACCACAGCTACTACACAC" 55 | # 56 | # temp2 = ''' 57 | # 58 | # LOCUS MyTemplate 48 bp ds-DNA circular 04-MAY-2017 59 | # DEFINITION . 60 | # ACCESSION MyTemplate 61 | # VERSION MyTemplate 62 | # KEYWORDS . 63 | # SOURCE 64 | # ORGANISM . . 65 | # COMMENT 66 | # COMMENT ApEinfo:methylated:1 67 | # FEATURES Location/Qualifiers 68 | # gene complement(join(34..48,1..12)) 69 | # /label=New Feature 70 | # /ApEinfo_fwdcolor="cyan" 71 | # /ApEinfo_revcolor="green" 72 | # /ApEinfo_graphicformat="arrow_data {{0 1 2 0 0 -1} {} 0} 73 | # width 5 offset 0" 74 | # ORIGIN 75 | # 1 gctactacac acgtactgac tgcctccaag atagagtcag taaccaca 76 | # // 77 | # 78 | # ''' 79 | # 80 | # tmp2 = read(temp2) 81 | # 82 | # new_feature2 = tmp2.features[0] 83 | # 84 | # assert str(new_feature2.extract(tmp2).seq) == "GTGTGTAGTAGCTGTGGTTACTGACTC" 85 | # 86 | # x2=tmp2._multiply_circular(2) 87 | # 88 | # assert str(x2.features[0].extract(x2).seq) == "GTGTGTAGTAGCTGTGGTTACTGACTC" 89 | 90 | if __name__ == "__main__": 91 | pytest.cmdline.main([__file__, "-v", "-s"]) 92 | -------------------------------------------------------------------------------- /tests/test_longerlocus_name_gives_dseq.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import pytest 4 | from pydna.readers import read 5 | 6 | 7 | def test_longername_gives_deseq(): 8 | myseq = read(open("broken_genbank_files/pGreenLantern1.gb", "r").read()) 9 | assert myseq.circular 10 | myseq = read(open("broken_genbank_files/fakeGenBankFile.gb", "r").read()) 11 | assert myseq.circular 12 | 13 | 14 | if __name__ == "__main__": 15 | pytest.main([__file__, "-x", "-vvv", "-s"]) 16 | -------------------------------------------------------------------------------- /tests/test_module__pretty.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_repr_pretty_(): 8 | from pydna._pretty import pretty_str 9 | from unittest.mock import MagicMock 10 | 11 | pp = MagicMock() 12 | s = pretty_str("123") 13 | t = s._repr_pretty_(pp, None) 14 | pp.text.assert_called_with("123") 15 | 16 | 17 | def test_PrettyTable(): 18 | from pydna._pretty import pretty_str 19 | from pydna._pretty import PrettyTable 20 | 21 | x = PrettyTable() 22 | 23 | x.field_names = ["City name", "Area", "Population", "Annual Rainfall"] 24 | x.add_rows( 25 | [ 26 | ["Adelaide", 1295, 1158259, 600.5], 27 | ["Brisbane", 5905, 1857594, 1146.4], 28 | ["Darwin", 112, 120900, 1714.7], 29 | ["Hobart", 1357, 205556, 619.5], 30 | ["Sydney", 2058, 4336374, 1214.8], 31 | ["Melbourne", 1566, 3806092, 646.9], 32 | ["Perth", 5386, 1554769, 869.4], 33 | ] 34 | ) 35 | 36 | assert x.lol() == [ 37 | ["City name", "Area", "Population", "Annual Rainfall"], 38 | ["Adelaide", 1295, 1158259, 600.5], 39 | ["Brisbane", 5905, 1857594, 1146.4], 40 | ["Darwin", 112, 120900, 1714.7], 41 | ["Hobart", 1357, 205556, 619.5], 42 | ["Sydney", 2058, 4336374, 1214.8], 43 | ["Melbourne", 1566, 3806092, 646.9], 44 | ["Perth", 5386, 1554769, 869.4], 45 | ] 46 | 47 | assert x.get_string() == x.__repr__() 48 | from prettytable import MARKDOWN as _md 49 | from copy import copy 50 | 51 | c = copy(x) 52 | c.set_style(_md) 53 | assert x._repr_markdown_() == pretty_str(c.get_string()) 54 | 55 | 56 | if __name__ == "__main__": 57 | pytest.main([__file__, "-vv", "-s"]) 58 | -------------------------------------------------------------------------------- /tests/test_module__thermodynamic_data.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_dHBr(): 8 | from pydna import _thermodynamic_data 9 | 10 | assert hasattr(_thermodynamic_data.dHBr, "setdefault") 11 | assert len(_thermodynamic_data.dHBr) == 16 12 | 13 | 14 | def test_dSBr(): 15 | from pydna import _thermodynamic_data 16 | 17 | assert hasattr(_thermodynamic_data.dSBr, "setdefault") 18 | assert len(_thermodynamic_data.dSBr) == 16 19 | 20 | 21 | if __name__ == "__main__": 22 | pytest.main([__file__, "-v", "-s"]) 23 | -------------------------------------------------------------------------------- /tests/test_module_all.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_repr(): 8 | pytest.importorskip("requests") 9 | 10 | from pydna import all 11 | 12 | assert all.__all__ == [ 13 | "Anneal", 14 | "pcr", 15 | "Assembly", 16 | "genbank", 17 | "Genbank", 18 | "download_text", 19 | "Dseqrecord", 20 | "Dseq", 21 | "read", 22 | "read_primer", 23 | "parse", 24 | "parse_primers", 25 | "ape", 26 | "primer_design", 27 | "assembly_fragments", 28 | "circular_assembly_fragments", 29 | "eq", 30 | "gbtext_clean", 31 | "PrimerList", 32 | ] 33 | 34 | 35 | if __name__ == "__main__": 36 | pytest.main([__file__, "-v", "-s"]) 37 | -------------------------------------------------------------------------------- /tests/test_module_crispr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_crispr(): 8 | from pydna.crispr import cas9, protospacer 9 | from pydna.dseqrecord import Dseqrecord 10 | from pydna.dseq import Dseq 11 | 12 | a = Dseq.from_representation( 13 | """\ 14 | GTTACTTTACCCGACGT 15 | CAATGAAATGGGCTGCA 16 | """ 17 | ) 18 | 19 | b = Dseq.from_representation( 20 | """\ 21 | CCCaGG 22 | GGGtCC 23 | """ 24 | ) 25 | 26 | sgr_text = "GTTACTTTACCCGACGTCCCgttttagagctagaaatagcaagttaaaataagg" 27 | target = "GTTACTTTACCCGACGTCCCaGG" 28 | 29 | for sg, tgt in [(sgr_text, target), (sgr_text.upper(), target.lower()), (sgr_text.lower(), target.upper())]: 30 | containing_sgRNA = Dseqrecord(sgr_text) 31 | target = Dseqrecord(target) 32 | 33 | assert [f.seq for f in target.cut([cas9(ps) for ps in protospacer(containing_sgRNA)])] == [a, b] 34 | assert [f.seq for f in target.cut([cas9(ps) for ps in protospacer(containing_sgRNA.rc())])] == [a, b] 35 | assert [f.seq for f in target.rc().cut([cas9(ps) for ps in protospacer(containing_sgRNA)])] == [b.rc(), a.rc()] 36 | assert [f.seq for f in target.rc().cut([cas9(ps) for ps in protospacer(containing_sgRNA.rc())])] == [ 37 | b.rc(), 38 | a.rc(), 39 | ] 40 | 41 | assert target.cut(cas9("GTTACTTTACCCGACGTCCC")) == target.cut(cas9("GTTACTTTACCCGACGTCCC".lower())) 42 | 43 | 44 | if __name__ == "__main__": 45 | pytest.main([__file__, "-vv", "-s"]) 46 | -------------------------------------------------------------------------------- /tests/test_module_download.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | pytest.importorskip("requests") 8 | 9 | 10 | @pytest.fixture 11 | def requests_mock(request): 12 | import requests_mock as rm_module 13 | 14 | m = rm_module.Mocker() 15 | m.start() 16 | request.addfinalizer(m.stop) 17 | return m 18 | 19 | 20 | def test_web(requests_mock, monkeypatch): 21 | from pydna import download 22 | 23 | monkeypatch.setenv("pydna_cached_funcs", "") 24 | 25 | import io 26 | 27 | flo = io.BytesIO(b"some text data") 28 | 29 | requests_mock.get( 30 | "http://www.fake.com/hej.txt", 31 | headers={ 32 | "last-modified": "Mon, 01 Jan 2001 00:00:00 GMT", # 978307200 33 | "content-length": "14", 34 | }, 35 | body=flo, 36 | ) 37 | 38 | tx = download.download_text("http://www.fake.com/hej.txt") 39 | 40 | assert tx == "some text data" 41 | 42 | 43 | if __name__ == "__main__": 44 | pytest.main([__file__, "-x", "-vv", "-s"]) 45 | -------------------------------------------------------------------------------- /tests/test_module_editor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | from unittest import mock 6 | 7 | 8 | def test_editor_wo_features(monkeypatch): 9 | import subprocess 10 | from pydna import editor 11 | 12 | Popen = mock.MagicMock(name="subprocess.Popen") 13 | monkeypatch.setattr("subprocess.Popen", Popen) 14 | monkeypatch.setenv("pydna_ape", "path/to/ape") 15 | from pydna.dseqrecord import Dseqrecord 16 | 17 | argument = Dseqrecord("ggatcc") 18 | editor.ape(argument) 19 | assert Popen.called 20 | 21 | 22 | def test_editor_with_feature_label(monkeypatch): 23 | import subprocess 24 | from pydna import editor 25 | 26 | Popen = mock.MagicMock(name="subprocess.Popen") 27 | monkeypatch.setattr("subprocess.Popen", Popen) 28 | monkeypatch.setenv("pydna_ape", "path/to/ape") 29 | from pydna.dseqrecord import Dseqrecord 30 | 31 | argument = Dseqrecord("ggatcc") 32 | argument.add_feature(2, 4, label="lbl") 33 | editor.ape(argument) 34 | assert Popen.called 35 | 36 | 37 | def test_editor_with_feature_note(monkeypatch): 38 | import subprocess 39 | from pydna import editor 40 | 41 | Popen = mock.MagicMock(name="subprocess.Popen") 42 | monkeypatch.setattr("subprocess.Popen", Popen) 43 | monkeypatch.setenv("pydna_ape", "path/to/ape") 44 | from pydna.dseqrecord import Dseqrecord 45 | 46 | argument = Dseqrecord("ggatcc") 47 | argument.add_feature(2, 4, note="nte") 48 | del argument.features[0].qualifiers["label"] 49 | editor.ape(argument) 50 | assert Popen.called 51 | 52 | 53 | def test_editor_with_feature_wo_label_and_note(monkeypatch): 54 | import subprocess 55 | from pydna import editor 56 | 57 | Popen = mock.MagicMock(name="subprocess.Popen") 58 | monkeypatch.setattr("subprocess.Popen", Popen) 59 | monkeypatch.setenv("pydna_ape", "path/to/ape") 60 | from pydna.dseqrecord import Dseqrecord 61 | 62 | argument = Dseqrecord("ggatcc") 63 | argument.add_feature(2, 4) 64 | del argument.features[0].qualifiers["label"] 65 | editor.ape(argument) 66 | assert Popen.called 67 | 68 | 69 | if __name__ == "__main__": 70 | pytest.main([__file__, "-x", "-vv", "-s"]) 71 | -------------------------------------------------------------------------------- /tests/test_module_fakeseq.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | 5 | def test_fakeseq(): 6 | from pydna.fakeseq import FakeSeq 7 | 8 | fs = FakeSeq(1000) 9 | 10 | assert fs.m() == 3.08979e-08 11 | 12 | assert len(fs) == 1000 13 | 14 | assert str(fs) == repr(fs) == "FakeSeq(1.0e+03)" 15 | 16 | assert fs > FakeSeq(999) 17 | 18 | 19 | if __name__ == "__main__": 20 | pytest.main([__file__, "-vv", "-s"]) 21 | -------------------------------------------------------------------------------- /tests/test_module_gel.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | 5 | def test_gel(): 6 | pytest.importorskip("PIL") 7 | 8 | import numpy as np 9 | 10 | from PIL import Image 11 | 12 | from pydna.gel import gel 13 | 14 | from pydna.gel import interpolator 15 | 16 | from pydna.ladders import PennStateLadder 17 | 18 | from pydna.ladders import HI_LO_DNA_MARKER 19 | 20 | from pydna.dseqrecord import Dseqrecord 21 | 22 | mygel = gel([PennStateLadder, [Dseqrecord("A" * 2000)]]) 23 | 24 | im = Image.open("pydna_gel.png") 25 | 26 | frame1 = np.asarray(mygel) 27 | frame2 = np.asarray(im) 28 | 29 | assert np.array_equal(frame1, frame2) 30 | 31 | ip = interpolator(HI_LO_DNA_MARKER) 32 | 33 | x = Dseqrecord("A" * 50) 34 | 35 | x.n *= 10 36 | 37 | mygel2 = gel([[x]], interpolator=ip) 38 | 39 | im = Image.open("pydna_gel2.png") 40 | 41 | frame3 = np.asarray(mygel2) 42 | frame4 = np.asarray(im) 43 | 44 | assert np.array_equal(frame3, frame4) 45 | 46 | 47 | if __name__ == "__main__": 48 | pytest.main([__file__, "-vv", "-s"]) 49 | -------------------------------------------------------------------------------- /tests/test_module_genbankfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_genbankfile(): 8 | from pydna import genbankfile 9 | 10 | gbf = genbankfile.GenbankFile("aaa", path="/path/") 11 | 12 | gbf.path == "/path/" 13 | 14 | assert repr(gbf) == "File(id)(-3)" 15 | 16 | assert gbf._repr_html_() == "/path/
" 17 | 18 | from unittest.mock import MagicMock 19 | 20 | pp = MagicMock() 21 | gbf._repr_pretty_(pp, None) 22 | pp.text.assert_called_with(repr(gbf)) 23 | 24 | gbf = gbf.rc() 25 | 26 | 27 | if __name__ == "__main__": 28 | pytest.main([__file__, "-vv", "-s"]) 29 | -------------------------------------------------------------------------------- /tests/test_module_genbankfixer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_pydna_gbtext_clean(): 8 | pytest.importorskip("pyparsing") 9 | 10 | from pydna.readers import read 11 | from pydna.genbankfixer import gbtext_clean 12 | 13 | files = [ 14 | ("sequence.gb", "ldseguid=_GHnVotdYSxAKX2bAUIa10ZZDhE"), 15 | ("NCBI_example.gb", "ldseguid=_GHnVotdYSxAKX2bAUIa10ZZDhE"), 16 | ("YEplac181.txt", "ldseguid=ktUgiF4Ah2i6zM8DbWewnTuwmkw"), 17 | ("pGADT7-Rec.gb", "cdseguid=L0wFG4Mx6rWMYej1cNpCqSYGOd0"), 18 | ("P30350%20(2013-10-11%2013_49_14).dna.txt", "cdseguid=cr9QvaW0QQWgiRNmG3W-ebeCQK0"), 19 | ("ApE_example.gb", "ldseguid=2oLvuMsAc-fgAISC7b3XJBuejGI"), 20 | ("VectorNTI_example.gb", "cdseguid=fLRW6jTMqqwZCbIFOGyl1TdDbrs"), 21 | ("hej.txt", "ldseguid=ktUgiF4Ah2i6zM8DbWewnTuwmkw"), 22 | ("fakeGenBankFile.gb", "cdseguid=cJQ-aN4c5sLYq7FcNLKr5ZVSdSM"), 23 | ] 24 | 25 | for file_, seg in files: 26 | with open("broken_genbank_files/" + file_, "r") as f: 27 | infile = f.read() 28 | if file_ == "hej.txt": 29 | from Bio import BiopythonParserWarning 30 | 31 | with pytest.warns(BiopythonParserWarning): 32 | assert read(gbtext_clean(infile).gbtext).seguid() == seg 33 | else: 34 | assert read(gbtext_clean(infile).gbtext).seguid() == seg 35 | 36 | 37 | def test_wrapstring(): 38 | pytest.importorskip("pyparsing") 39 | 40 | from pydna.genbankfixer import wrapstring 41 | 42 | assert ( 43 | wrapstring( 44 | "0123456789", 45 | 0, 46 | 5, 47 | ) 48 | == "01234\n56789\n\n" 49 | ) 50 | assert wrapstring("0123456789", 1, 5, padfirst=False) == "0123\n 4567\n 89\n" 51 | 52 | 53 | if __name__ == "__main__": 54 | pytest.main([__file__, "-x", "-vvv", "-s"]) 55 | -------------------------------------------------------------------------------- /tests/test_module_genbankrecord.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_genbankfile(): 8 | from pydna import genbankrecord 9 | 10 | gbr = genbankrecord.GenbankRecord("aaa") 11 | 12 | assert ( 13 | gbr.hyperlink 14 | == "accession" 15 | ) 16 | 17 | assert repr(gbr) == "Gbnk(-3 accession)" 18 | 19 | assert ( 20 | gbr._repr_html_() 21 | == "accession" 22 | ) 23 | 24 | from unittest.mock import MagicMock 25 | 26 | pp = MagicMock() 27 | 28 | gbr._repr_pretty_(pp, None) 29 | 30 | pp.text.assert_called_with("Gbnk(-3 accession)") 31 | 32 | gbr = genbankrecord.GenbankRecord("aaa", start=1, stop=2) 33 | 34 | assert gbr.hyperlink == ( 35 | "accession 1-2" 38 | ) 39 | 40 | gbr_rc = gbr.rc() 41 | 42 | assert gbr_rc.strand == 2 43 | 44 | gbr2 = genbankrecord.GenbankRecord("atgttcctacatg", item="CS570233.1", start=1, stop=13, strand=1) 45 | assert repr(gbr2) == "Gbnk(-13 CS570233.1 1-13)" 46 | 47 | gbr2.pydna_code() == ( 48 | "from pydna.genbank import Genbank\n" 49 | "gb = Genbank('bjornjobb@gmail.com')\n" 50 | "seq = gb.nucleotide('CS570233.1',\n" 51 | " seq_start=1,\n" 52 | " seq_stop=13,\n" 53 | " strand=1)" 54 | ) 55 | 56 | gbr2.biopython_code() == """\ 57 | from Bio import Entrez, SeqIO 58 | Entrez.email = 'bjornjobb@gmail.com' 59 | handle = Entrez.efetch(db='nuccore', 60 | id='CS570233.1', 61 | rettype='gbwithparts', 62 | retmode='text', 63 | seq_start=1, 64 | seq_stop=13, 65 | strand=1) 66 | record = SeqIO.read(handle, 'genbank')""" 67 | 68 | from Bio.Seq import Seq 69 | from pydna.seqrecord import SeqRecord 70 | 71 | arg = SeqRecord(Seq("aaa")) 72 | 73 | genbankrecord.GenbankRecord.from_SeqRecord(arg) 74 | 75 | genbankrecord.GenbankRecord.from_SeqRecord(arg, start=0, stop=2) 76 | 77 | 78 | if __name__ == "__main__": 79 | pytest.main([__file__, "-vv", "-s"]) 80 | -------------------------------------------------------------------------------- /tests/test_module_ligate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | 5 | def test_ligate(): 6 | from pydna.ligate import ligate 7 | from pydna.dseq import Dseq 8 | from pydna.dseqrecord import Dseqrecord 9 | 10 | a = Dseqrecord( 11 | Dseq.from_representation( 12 | """ 13 | GATCaaa 14 | tttTTCC""" 15 | ) 16 | ) 17 | b = Dseqrecord( 18 | Dseq.from_representation( 19 | """ 20 | AAGGatta 21 | taatAGGA""" 22 | ) 23 | ) 24 | c = Dseqrecord( 25 | Dseq.from_representation( 26 | """ 27 | TCCTccact 28 | ggtgaCTAG""" 29 | ) 30 | ) 31 | 32 | d = Dseqrecord( 33 | Dseq.from_representation( 34 | """ 35 | Tcgcgc 36 | gcgcgC""" 37 | ) 38 | ) 39 | 40 | e = Dseqrecord( 41 | Dseq.from_representation( 42 | """ 43 | Gcaatt 44 | gttaa""" 45 | ) 46 | ) 47 | 48 | fragments = [a, b, c, d, e] 49 | rcfragments = [a.rc(), b.rc(), c.rc(), d.rc(), e.rc()] 50 | 51 | def list_combinations(a, b): 52 | N = len(a) 53 | combinations = [] 54 | for i in range(2**N): 55 | current = [] 56 | for j in range(N): 57 | if i & (1 << j): 58 | current.append(a[j]) 59 | else: 60 | current.append(b[j]) 61 | combinations.append(current) 62 | 63 | return combinations 64 | 65 | # Example usage: 66 | combinations = list_combinations(fragments, rcfragments) 67 | 68 | for frgs in combinations: 69 | csequences, lsequences = ligate(frgs) 70 | for cs in csequences: 71 | assert cs.seguid() == "cdseguid=ogVOwoSZEk_4kUWnK1NCl5Dv1z4" 72 | assert len(cs) == 24 73 | for ss in lsequences: 74 | assert ss.seguid() == "ldseguid=vBQxmszgfR4b84O0wI7d_ya9uDA" 75 | assert len(ss) == 12 76 | 77 | 78 | if __name__ == "__main__": 79 | pytest.main([__file__, "-vv", "-s"]) 80 | -------------------------------------------------------------------------------- /tests/test_module_primer.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import pytest 3 | 4 | 5 | def test_primer(): 6 | from pydna import primer 7 | 8 | x = primer.Primer("gtatcatatctatctatcta", footprint=12) 9 | 10 | assert str(x.seq) == "gtatcatatctatctatcta" 11 | assert str(x.tail) == "gtatcata" 12 | assert str(x.footprint) == "tctatctatcta" 13 | assert repr(x) == "id 20-mer:5'-gtatcatatctatctatcta-3'" 14 | # assert x.tm() == 41.04993874467033 15 | 16 | assert x[0] == "g" 17 | 18 | w = x[2:15] 19 | 20 | assert repr(w) == "part_id 13-mer:5'-atcatatctatct-3'" 21 | assert str(w.seq) == "atcatatctatct" 22 | 23 | y = "AAA" + w 24 | 25 | assert isinstance(y, type(w)) 26 | assert str(y.seq) == "AAAatcatatctatct" 27 | 28 | from Bio.Seq import Seq 29 | from Bio.SeqRecord import SeqRecord 30 | 31 | arg = "AAA" 32 | 33 | # print(str(x.seq).rjust(20)) 34 | # print(str(x.tail)) 35 | # print(str(x.footprint).rjust(20)) 36 | # 37 | # 38 | # 39 | # print(str(w.seq).ljust(20)) 40 | # print(str(w.tail)) 41 | # print(str(w.footprint).rjust(15)) 42 | 43 | 44 | if __name__ == "__main__": 45 | pytest.main([__file__, "-vv", "-s"]) 46 | -------------------------------------------------------------------------------- /tests/test_module_tm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import pytest 5 | 6 | 7 | def test_tms(): 8 | from pydna import tm 9 | 10 | # args = [] 11 | # kwargs = {"key": "value"} 12 | 13 | primer = "AGTCTAGTCTGTGTAGTTTCGACTAGTCTATCG" 14 | # primer = "agatcgactatctatcttatgcactatgtctat" 15 | 16 | # assert 55.08264292462792 == tm.tmstaluc98(primer,*args, dnac=50, saltc=50, **kwargs) 17 | # assert 63.86257335124958 == tm.tmbreslauer86(primer, *args, dnac=500.0, saltc=50, thermodynamics=False, **kwargs) 18 | # assert (63.86257335124958, 229.4, 650.4777432533716) == tm.tmbreslauer86(primer, *args, dnac=500.0, saltc=50, thermodynamics=True, **kwargs) 19 | # assert 63.598585735078075 == tm.tmbresluc(primer, *args, primerc=500.0, saltc=50, thermodynamics=False, **kwargs) 20 | # assert (63.598585735078075, -234400, -615.1999999999998) == tm.tmbresluc(primer, *args, primerc=500.0, saltc=50, thermodynamics=True, **kwargs) 21 | # assert 88 == tm.basictm(primer, *args, **kwargs) 22 | 23 | # There were corrections in the biopython DNA_NN4 table 24 | # https://github.com/biopython/biopython/pull/4240/commits/9772fcbd38dbed125fc34dd0820f3395bc613917 25 | 26 | assert tm.tm_default(primer) == pytest.approx(66.17116877436496) # 67.78918110181166 27 | assert tm.tm_dbd(primer) == pytest.approx(62.74633103079093) 28 | assert tm.tm_product(primer * 20) == pytest.approx(76.27411419319003) 29 | assert tm.ta_default(primer, primer, primer * 20) == pytest.approx(58.34323056754251) # 58.82863426577652 30 | assert tm.ta_dbd(primer, primer, primer * 20) == pytest.approx(65.74633103079093) 31 | assert tm.tmbresluc(primer) == pytest.approx(63.38496307044147) 32 | 33 | with pytest.raises(NotImplementedError): 34 | tm.Q5(primer) 35 | 36 | 37 | def test_tm_neb(): 38 | from pydna import tm 39 | import requests 40 | from unittest.mock import patch 41 | 42 | primer = "AGTCTAGTCTGTGTAGTTTCGACTAGTCTATCG" 43 | 44 | assert type(tm.tm_neb(primer)) is int 45 | 46 | # Test invalid sequence 47 | with pytest.raises(requests.exceptions.HTTPError) as excinfo: 48 | tm.tm_neb("blah") 49 | 50 | assert "[Errno 400]" in str(excinfo.value) 51 | 52 | # Test server down 53 | with patch("requests.get") as mock_get: 54 | mock_get.side_effect = requests.exceptions.ConnectionError() 55 | 56 | with pytest.raises(requests.exceptions.ConnectionError) as excinfo: 57 | tm.tm_neb("blah") 58 | 59 | assert "Could not connect to NEB API" in str(excinfo.value) 60 | 61 | 62 | if __name__ == "__main__": 63 | pytest.main([__file__, "-vv", "-s"]) 64 | --------------------------------------------------------------------------------