Coder Social home page Coder Social logo

dnaplotlib's Introduction

DNAplotlib

DNAplotlib is a library that enables highly customizable visualization of individual genetic constructs and libraries of design variants. It can be thought of in many ways as matplotlib for genetic diagrams. Publication quality vector-based output is produced and all aspects of the rendering process can be easily customized or replaced by the user. DNAplotlib is capable of SBOL Visual compliant diagrams in addition to a format able to better illustrate the precise location and length of each genetic part. This alternative "traced-based" visualization method enables direct comparison with nucleotide-level information such as RNA-seq read depth or other base resolution measures. While it is envisaged that access will be predominantly via the programming interface, several easy to use text-based input formats can be processed by a command-line scripts to facilitate broader usage. DNAplotlib is cross-platform and open-source software released under the OSI OSL-3.0 license.

If you make use of DNAplotlib in any publications, we kindly ask that the following paper is cited:

Der B.S., Glassey E., Bartley B.A., Enghuus C., Goodman D.B., Gordon D.B., Voigt C.A., Gorochowski T.E., "DNAplotlib: programmable visualization of genetic designs and associated data", ACS Synthetic Biology, 2016. (DOI: 10.1021/acssynbio.6b00252)

Installation

The DNAplotlib library is contained within the dnaplotlib.py file in the lib directory and requires Python 3.6+ and matplotlib 3.8+. To install add the location of this file to your PYTHONPATH and you are good to: import dnaplotlib

Getting Started

We provide an extensive gallery of use cases for DNAplotlib in the gallery directory. Click on a thumbnail below to go directly to the example code:

Genetic Designs and Annotation

New Part Types and Regulation

Trace-based Rendering

Dynamics and Evolution

Variant Libraries

Build

Create a virtual env:

python3 -m venv .venv

activate the venv:

source .venv/bin/activate

Install dependancies

pip install -r requirements.txt

dnaplotlib's People

Contributors

audy avatar bder avatar castillohair avatar chofski avatar cinaljess avatar nroehner avatar piotrzakrzewski avatar souravsingh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dnaplotlib's Issues

Key Error: 'start'

Hi,
I've encountered an issue in the renderDNA function (dnaplotlib/dnaplotlib.py). Each part object must have a 'start' and an 'end' value. If these values are not provided by the user, then it causes a "Key Error" in case the part is reverse oriented. (line 2574-2577).

For me, this simple fix solved the problem:
#start = part['start']
#end = part['end']
part['end'] = part_num + 1
part['start'] = part_num

Thanks,
Ernst

Y offset for overlapping reading frames

Would it be possible to please add a y offset for overlapping reading frames? It is very useful for adding primers for linear plasmid diagrams. I'm currently working in a lab and we are targeting HIV with crispr, but it is very difficult to show where exactly you are targeting with other available tools (snapgene is too generic and you can't edit like you can with this tool). A y offset for the different elements would solve this problem.

hiv-genome

orientation issue

The library_plot.py scripts in here do a reversal of the begin and end dictionary values for parts, but this reversal also happens in the dnaplotlib module, so reversal gets reversed, if you will! I just commented out these lines from the library_plot.py script and all is well again. Seems like it'd be good to remove these, since the reversal is handled completely in the module?

if fwd == True:
	part_design['start'] = i
	part_design['end'] = i+1
else:
	part_design['end'] = i
	part_design['start'] = i+1

Arc height not changing with regulation type connection

In the example of the recombinase_not_gate.py, I'm trying to get the arc to be lower because they overlay the sequence from above in the figure for sequences longer than in the example.

However, despite changing the arc_height argument, the height isn't changing, and I haven't been successful at finding why. When changing arc_height in the xnor_truthtable.py example, it's working.

I'm using python 3.6.1 and matplotlib 2.0.2

Adjusting Figure Parameters

I am curious how to do a few things or suggesting features if they aren't currently possible.

First: Adjusting title spacing on the variants library
I tried out the variants library script but it's cutting off my titles and I can't figure out how to fix it. Even better would be to adjust it dynamically with title name.
variants_library

Second: Adjust y-spacing on library_plot script
Again I tried out the library_plot but the spacing between the constructs is huge and I can't seem to reduce it without cutting off the regulation info.
test1

I was also wondering if there is a convenient way to have multiple bars for each construct for the performance data on the variants library type script. It would be nice to be able to show induced and un-induced data. I assume it must be possible but I haven't torn into the script enough to figure it out yet.

Also, is there a way to produce a figure legend? Either as part of the figure or as a separate png would be helpful. I'm testing out RBS variants and it would be helpful to show what the colours mean.

Finally, is there a way to show regulation by environmental factors or factors on a different "chromosome"?

Thanks, for your help.
This library is pretty awesome so please keep up the fantastic work.

Proportional sizes of features

I am trying to plot genes proportional to their sizes in a genome and encountering some issues. I noticed that the same issue occurs in the input_gff example, where all of the genes are plotted similar in size even though the GFF file specifies that gene C should be almost twice the size of gene A (1563 nt vs 882 nt). I'd appreciate any feedback on whether I'm interpreting things wrong or whether this may be a bug. Thanks for this cool library!!

RNA Fusions

Came across your package and was wondering if there are defined workflows for plotting a gene fusion. Is this possible or potentially possible with some minimal dev work on my end?

API Docs

I've been reading the source code and the example scripts for documentation of all the plot fields (things like label, label_y_offset, label_size etc.). Are these documented somewhere?

Suggestion

Hi Thomas et al.,

I finally got to use DNAplotlib. Very cool app. I have a suggestion to quick.py, if you don't mind:

Currently, quick.py is executed this way:

python quick.py -input "p.gray i.lightblue r.lightred c.green t.orange -t.purple -c.black -r.yellow -p.yellow" -output out.pdf

a user passes orientation, part type, and color in the list of parameters.

SUGGESTION:
It would be very useful if a user could also pass optional part instance:

python quick.py -input "p1.gray i1.lightblue r1.lightred c2.green t1.orange t1.purple c1.black r1.yellow p1.yellow" -output out.pdf

and the program would parse those part instances and generate corresponding labels under each part on the PDF image:
"p1" or "i1" or "cds2" (or "g2") e.t.c. If user did not provide part instance, then label won't be generated.

P.S. in the description, it doesn't say that the image can also be saved as .png
-output out.png

@chofski

Cheers,
-Y

Support of new symbols (SBOL Visual 2.0)

Thank you for the great tool! Will the glyphs be updated with the latest symbols for SBOL visual 2.0? I am particularly interested in the binding sites and non-coding sequence glyphs.

What is the "circle-X" glyph?

I see there is a glyph offered by DNAplotlib that is a circle with an X inside of it. What is that intended to represent? If it's useful, I'd like to import it into SBOL Visual.

Ability to annotate SBOL designs

Often designs need to be annotated in multiple places to highlight for example primer binding sites. These are not necessarily part of the original design, but are required in the visualisation. Such an ability needs to be integrated into the library - annotate type function would work well.

GFF plotting CLI tool

It's very helpful that you have CLI tools for plotting SBOL files. I suspect another common use-case for this tool is plotting GFF files directly from the command line, and you already have a great library function for doing that. Would you accept a PR adding a gffplot CLI tool?

Reverse orientation crashes dnaplotlib

Using 703c734 (current master), the following script:

import dnaplotlib as dpl
import matplotlib.pyplot as plt

p1 = {'type':'Promoter', 'name':'p1', 'fwd':True}
c1 = {'type':'CDS', 'name':'c1', 'fwd':True}
design1 = [p1, c1]

# Create the DNAplotlib renderer
dr = dpl.DNARenderer()

# Redend the DNA to axis
fig, ax = plt.subplots()
start, end = dr.renderDNA(ax, design1, dr.SBOL_part_renderers())
ax.set_xlim([start, end])
ax.set_ylim([-15,15])
ax.set_aspect('equal')
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')

plt.savefig('test_promoter.png', dpi=200)

only works when the fwd property in lines 4 and 5 are set to True, but fails if any of them are set to False with the following error message:

Traceback (most recent call last):
  File "test_dnaplotlib.py", line 74, in <module>
    start, end = dr.renderDNA(ax, design1, dr.SBOL_part_renderers())
  File "C:\Users\casti\Anaconda3\lib\site-packages\dnaplotlib\dnaplotlib.py", line 2295, in renderDNA
    start = part['start']
KeyError: 'start'

It seems that the code introduced in #14 is what causes this error. This makes sense, as 'start' and 'end' are not necessarily properties of all parts. Removing this piece of code restores the proper behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.