{"id":21466733,"url":"https://github.com/edinburgh-genome-foundry/crazydoc","last_synced_at":"2025-07-03T18:09:27.597Z","repository":{"id":62565313,"uuid":"120041037","full_name":"Edinburgh-Genome-Foundry/crazydoc","owner":"Edinburgh-Genome-Foundry","description":"Read DNA sequences from colourful Microsoft Word documents","archived":false,"fork":false,"pushed_at":"2025-03-31T11:53:47.000Z","size":5693,"stargazers_count":32,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T22:16:06.686Z","etag":null,"topics":["bioinformatics","computer-aided-design","dna-sequences","molecular-biology","synthetic-biology"],"latest_commit_sha":null,"homepage":"https://edinburgh-genome-foundry.github.io/crazydoc/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edinburgh-Genome-Foundry.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-02T23:07:51.000Z","updated_at":"2025-03-31T11:51:18.000Z","dependencies_parsed_at":"2025-07-03T18:09:08.988Z","dependency_job_id":null,"html_url":"https://github.com/Edinburgh-Genome-Foundry/crazydoc","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Edinburgh-Genome-Foundry/crazydoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fcrazydoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fcrazydoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fcrazydoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fcrazydoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edinburgh-Genome-Foundry","download_url":"https://codeload.github.com/Edinburgh-Genome-Foundry/crazydoc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2Fcrazydoc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263376125,"owners_count":23457333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","computer-aided-design","dna-sequences","molecular-biology","synthetic-biology"],"created_at":"2024-11-23T08:15:15.338Z","updated_at":"2025-07-03T18:09:27.579Z","avatar_url":"https://github.com/Edinburgh-Genome-Foundry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg alt=\"crazydoc Logo\" title=\"crazydoc Logo\" src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/crazydoc/master/images/title.png\" width=\"550\"\u003e\n    \u003cbr /\u003e\u003cbr /\u003e\n    \u003c/p\u003e\n\n\n.. image:: https://github.com/Edinburgh-Genome-Foundry/crazydoc/actions/workflows/build.yml/badge.svg\n   :target: https://github.com/Edinburgh-Genome-Foundry/crazydoc/actions/workflows/build.yml\n   :alt: GitHub CI build status\n\n.. image:: https://coveralls.io/repos/github/Edinburgh-Genome-Foundry/crazydoc/badge.svg?branch=master\n   :target: https://coveralls.io/github/Edinburgh-Genome-Foundry/crazydoc?branch=master\n\n\nCrazydoc is a Python library to parse one of the most common DNA representation formats: the joyfully coloured and stylishly annotated MS Word document.\n\n.. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/crazydoc/master/images/screenshot.png\" width=\"600\"\u003e\n    \u003c/p\u003e\n\nCrazydoc returns Biopython records of the sequences contained in an MS Word document, with record features corresponding to the various sequence highlightings (background color, boldness, italics, case change, etc.). The records can saved as GenBanks or easily plotted.\n\n.. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/crazydoc/master/images/records_plots.png\" width=\"800\"\u003e\n    \u003c/p\u003e\n    \n**Motivation**\n\nWhile other standards such as FASTA or Genbank are better supported by modern sequence editors, none enjoys the same popularity among molecular biologist as MS Word's ``.docx`` format, which is limited only by the sophistication and creativity of the user.\n\nRelying on a loose syntax and unclear specifications, this format has however suffered from a lack of support in the developers community and is generally incompatible with mainstream software pipelines. This library allows to convert MS Word DNA sequences to more computing friendly formats: Biopython records, FASTA, or annotated Genbanks.\n\nUsage\n-----\n\nTo obtain all sequences contained in a docx as annotated Biopython records (such as `this one \u003chttps://raw.githubusercontent.com/Edinburgh-Genome-Foundry/crazydoc/master/examples/example.docx\u003e`_):\n\n.. code:: python\n\n    from crazydoc import CrazydocParser\n    parser = CrazydocParser(['highlight_color', 'bold', 'underline'])\n    biopython_records = parser.parse_doc_file(\"./example.docx\")\n\nYou can then plot the obtained records:\n\n.. code:: python\n\n    from crazydoc import CrazydocSketcher\n    sketcher = CrazydocSketcher()\n    for record in biopython_records:\n        sketch = sketcher.translate_record(record)\n        ax, _ = sketch.plot()\n        ax.set_title(record.id)\n        ax.figure.savefig('%s.png' % record.id)\n\n.. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/crazydoc/master/images/records_plots.png\" width=\"800\"\u003e\n    \u003c/p\u003e\n\nTo write the sequences down as Genbank records, with annotations:\n\n.. code:: python\n\n    from crazydoc import records_to_genbank\n    records_to_genbank(biopython_records)\n\nNote that ``records_to_genbank()`` will truncate the record name to 20 characters, \nto fit in the GenBank format. Additionally, slashes (``/``) will be replaced with \nhyphens (``-``) in the filenames. To read protein sequences, pass ``is_protein=True``:\n\n.. code:: python\n\n    biopython_records = parse_doc_file(protein_path, is_protein=True)\n\nThis will return *protein* records, which will be saved with a GenPept extension \n(.gp) by ``records_to_genbank(biopython_records, is_protein=True)``, \nunless specified otherwise with ``extension=``.\n\nYou can also save annotated sequences as colourful Word docs.\n``write_crazydoc()`` takes a SeqRecord, the qualifier key to use as a feature name,\nand a path to save the document to.\n\n.. code:: python\n\n    # Load an annotated sequence with Biopython\n    from Bio import SeqIO\n    from crazydoc import write_crazydoc\n    seq = SeqIO.read(\"examples/examples_outputs/Sequence 1.gbk\", \"genbank\")\n    # Most features will already have some name qualifier but you can add your own\n    for i,f in enumerate(seq.features):\n        f.qualifiers['product'] = f\"feature{i}\"\n    # Save the annotated sequence as a docx\n    write_crazydoc(seq, 'product', 'test.docx')\n\n\nInstallation\n------------\n\nYou can install crazydoc through PIP:\n\n.. code::\n\n    pip install crazydoc\n\nAlternatively, you can unzip the sources in a folder and type:\n\n.. code::\n\n    python setup.py install\n\nLicense = MIT\n-------------\n\nCrazydoc is an open-source software originally written at the `Edinburgh Genome Foundry \u003chttp://genomefoundry.org\u003e`_ by `Zulko \u003chttps://github.com/Zulko\u003e`_ and `released on Github \u003chttps://github.com/Edinburgh-Genome-Foundry/crazydoc\u003e`_ under the MIT licence (Copyright 2018 Edinburgh Genome Foundry).\n\nEveryone is welcome to contribute!\n\nMore biology software\n---------------------\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Edinburgh-Genome-Foundry.github.io/master/static/imgs/logos/egf-codon-horizontal.png\n  :target: https://edinburgh-genome-foundry.github.io/\n\nCrazydoc is part of the `EGF Codons \u003chttps://edinburgh-genome-foundry.github.io/\u003e`_ synthetic biology software suite for DNA design, manufacturing and validation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedinburgh-genome-foundry%2Fcrazydoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedinburgh-genome-foundry%2Fcrazydoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedinburgh-genome-foundry%2Fcrazydoc/lists"}