Difference between revisions of "Template:Heidelberg/pages/software/plasmid"

 
Line 1: Line 1:
 
<html>
 
<html>
<head>
+
 
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
+
<head>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
+
<script src="plasmid.js" type="text/javascript" charset="utf-8"></script>
+
<script>
+
$(function() {
+
    var inserts = [
+
        {
+
            size: 40,
+
            color: "#0F0",
+
            label: "GFP",
+
            description: "Green Fluorescent Protein",
+
            gap: false,
+
            promoter: true
+
        },
+
        {
+
            size: 10,
+
            color: "#F00",
+
            label: "Brow Fox",
+
            description: "Ein super genial, extra tolles, nur f&uuml;r iGEM entwickeltes Insert.",
+
            gap: true
+
        },
+
        {
+
            size: 46,
+
            color: "#00F",
+
            label: "_________1_________2_________3_________4_________5_________6________7_________8",
+
            description: "Der Editor ist M&uuml;ll :/"
+
        },
+
        {
+
            size: 19,
+
            color: "#0FF",
+
            label: "Short one",
+
            description: "Wirklich, Wirklich kurz nun auch wieder nicht.",
+
            promoter: true
+
        },
+
        {
+
            size:1,
+
            color: "#FF0",
+
            label: "Even shorter one",
+
            description: "Und knackig",
+
            gap: false,
+
            promoter: true
+
        }
+
    ];
+
   
+
    var plasmid = new Plasmid('canvas', 'info', inserts, 500);
+
    plasmid.draw();
+
});
+
</script>
+
</head>
+
<body>
+
<div class="container">
+
<div class="content">
+
<div class="row">
+
<div class="col-lg-12">
+
<div class="panel panel‐default">
+
<div class="panel‐heading">
+
<h3 class="basicheader">plasmid.js - Interactive plasmids</h3>
+
</div>
+
<!-- panel-heading -->
+
<div class="panel‐body">
+
<div class="row">
+
<h1>
+
plasmid.js - Interactive plasmids
+
<p class="basictext">
+
It is always cubersome to create vector maps, and then putting the static images on the web. We thought it would be a lot more fun to just autogenerate interactive plasmids dynamically from data. That's why we wrote plasmid.js, a JavaScript library to generate interactive vector maps for web pages.
+
</p>
+
<h2> Why should you use it? </h2>
+
<p class="basictext">It is dead simple to use!</p>
+
<p class="basictext">The includes
+
<pre><code language="language-html">
+
 
     <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
 
     <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
 
     <script src="raphael.js" type="text/javascript" charset="utf-8"></script>
 
     <script src="raphael.js" type="text/javascript" charset="utf-8"></script>
 
     <script src="plasmid.js" type="text/javascript" charset="utf-8"></script>
 
     <script src="plasmid.js" type="text/javascript" charset="utf-8"></script>
</code></pre>
+
     <script>
</p>
+
<p class="basictext">
+
The placeholders
+
<pre><code language="language-html">
+
     <div id="canvas"></div>
+
    <div id="info">Hover over an element to get more information!</div>
+
</code></pre>
+
</p>
+
<p class="basictext">
+
The JavaScript
+
<pre><code language="language-js">
+
 
         $(function() {
 
         $(function() {
 
             // You could also load your data via AJAX
 
             // You could also load your data via AJAX
 
             var inserts = [
 
             var inserts = [
                {
+
            {
                    size: 40, // Size in angles! (there are 360 of them available)
+
                size: 40, // Size in angles! (there are 360 of them available)
                    color: "#0F0", // You can use any valid css format
+
                color: "#0F0", // You can use any valid css format
                    label: "GFP", // The label to display in the legend
+
                label: "GFP", // The label to display in the legend
                    description: "Green Fluorescent Protein", // The description to put in the infobox
+
                description: "Green Fluorescent Protein", // The description to put in the infobox
                    gap: false, // If not given this defaults to true
+
                gap: false, // If not given this defaults to true
                    promoter: true // This is a promoter, defaults to false
+
                promoter: true // This is a promoter, defaults to false
                },
+
            },
                {
+
            {
                    size: 10,
+
                size: 10,
                    color: "#F00",
+
                color: "#F00",
                    label: "Brow Fox",
+
                label: "Brow Fox",
                    description: "He likes jumping over dogs.",
+
                description: "He likes jumping over dogs.",
                    gap: true
+
                gap: true
                },
+
            },
                {
+
            {
                    size: 46,
+
                size: 46,
                    color: "#00F",
+
                color: "#00F",
                    label: "Lazy Dog",
+
                label: "Lazy Dog",
                    description: "He likes beeing jumpt over."
+
                description: "He likes beeing jumpt over."
                },
+
            },
                {
+
            {
                    size: 19,
+
                size: 19,
                    color: "#0FF",
+
                color: "#0FF",
                    label: "Short one",
+
                label: "Short one",
                    description: "Wirklich, Wirklich kurz nun auch wieder nicht.",
+
                description: "Wirklich, Wirklich kurz nun auch wieder nicht.",
                    promoter: true
+
                promoter: true
                },
+
            },
                {
+
            {
                    size:1,
+
                size: 1,
                    color: "#FF0",
+
                color: "#FF0",
                    label: "Even shorter one",
+
                label: "Even shorter one",
                    description: "Und knackig",
+
                description: "Und knackig",
                    gap: false,
+
                gap: false,
                    promoter: true
+
                promoter: true
                }
+
             }];
             ];
+
 
           
+
 
             // Required parameters are: id of the canvas, id of the infobox,
 
             // Required parameters are: id of the canvas, id of the infobox,
 
             // the inserts and the diameter of the plasmid. Note, that there
 
             // the inserts and the diameter of the plasmid. Note, that there
Line 134: Line 53:
 
             plasmid.draw();
 
             plasmid.draw();
 
         });
 
         });
 +
    </script>
 +
</head>
 +
 +
<body>
 +
 +
<div class="container">
 +
 +
<div class="content">
 +
 +
<div class="row">
 +
 +
<div class="col-lg-12">
 +
 +
<div class="panel panel‐default">
 +
 +
<div class="panel‐heading">
 +
 +
<h3 class="basicheader">plasmid.js - Interactive plasmids</h3>
 +
 +
</div> <!-- panel-heading -->
 +
 +
<div class="panel‐body">
 +
 +
<div class="row">
 +
 +
<h1>plasmid.js - Interactive plasmids
 +
 +
<p class="basictext">
 +
It is always cubersome to create vector maps, and then putting the static images on the web. We thought it would be a lot more fun to just autogenerate interactive plasmids dynamically from data. That's why we wrote plasmid.js, a JavaScript library to generate interactive vector maps for web pages.
 +
</p>
 +
 +
<h2> Why should you use it? </h2>
 +
<p class="basictext">It is dead simple to use!</p>
 +
 +
<p class="basictext">The includes
 +
<pre>
 +
    <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
 +
    <script src="raphael.js" type="text/javascript" charset="utf-8"></script>
 +
    <script src="plasmid.js" type="text/javascript" charset="utf-8"></script>
 
</pre>
 
</pre>
</code>
+
</p>
<p>Plus, it also looks great!</p>
+
 
<div id="canvas"></div>
+
<p class="basictext">
<div id="info">Hover over an element to get more information!</div>
+
The placeholders
<h2>Further options</h2>
+
<pre>
<p>There are two ways to specify optional settings; you can either pass them via the constructor or set the corresponding attributes after the object is created (it's JavaScript, ...). Below you can see a annotated version of the constructor.
+
    <div id="canvas"></div>
<pre><code language="language-js">
+
    <div id="info">Hover over an element to get more information!</div>
 +
</pre>
 +
</p>
 +
 
 +
<p class="basictext">
 +
The JavaScript
 +
<pre><code language="language-js">
 +
                $(function() {
 +
            // You could also load your data via AJAX
 +
            var inserts = [
 +
            {
 +
                size: 40, // Size in angles! (there are 360 of them available)
 +
                color: "#0F0", // You can use any valid css format
 +
                label: "GFP", // The label to display in the legend
 +
                description: "Green Fluorescent Protein", // The description to put in the infobox
 +
                gap: false, // If not given this defaults to true
 +
                promoter: true // This is a promoter, defaults to false
 +
            },
 +
            {
 +
                size: 10,
 +
                color: "#F00",
 +
                label: "Brow Fox",
 +
                description: "He likes jumping over dogs.",
 +
                gap: true
 +
            },
 +
            {
 +
                size: 46,
 +
                color: "#00F",
 +
                label: "Lazy Dog",
 +
                description: "He likes beeing jumpt over."
 +
            },
 +
            {
 +
                size: 19,
 +
                color: "#0FF",
 +
                label: "Short one",
 +
                description: "Wirklich, Wirklich kurz nun auch wieder nicht.",
 +
                promoter: true
 +
            },
 +
            {
 +
                size: 1,
 +
                color: "#FF0",
 +
                label: "Even shorter one",
 +
                description: "Und knackig",
 +
                gap: false,
 +
                promoter: true
 +
            }];
 +
 
 +
            // Required parameters are: id of the canvas, id of the infobox,
 +
            // the inserts and the diameter of the plasmid. Note, that there
 +
            // is spacing and a legend added (default: width + 575, height + 50)
 +
            // These values can be changed easily, see below.
 +
            var plasmid = new Plasmid('canvas', 'info', inserts, 500);
 +
            plasmid.draw();
 +
        });
 +
</pre></code>
 +
 
 +
<p>Plus, it also looks great!</p>
 +
<div id="canvas"></div>
 +
<div id="info">Hover over an element to get more information!</div>
 +
 
 +
<h2>Further options</h2>
 +
<p>There are two ways to specify optional settings; you can either pass them via the constructor or set the corresponding attributes after the object is created (it's JavaScript, ...). Below you can see a annotated version of the constructor.
 +
<pre><code language="language-js">
 
function Plasmid(canvas, infobox, inserts, diameter, legendWidth, insertWidth, defaultText, insertBoxAttr, fontSize, spacing, startAngle) {
 
function Plasmid(canvas, infobox, inserts, diameter, legendWidth, insertWidth, defaultText, insertBoxAttr, fontSize, spacing, startAngle) {
 
     // Are all required parameters given?
 
     // Are all required parameters given?
Line 168: Line 188:
 
</code>
 
</code>
 
</pre>
 
</pre>
</div>
+
 
<!-- col-lg-12 -->
+
</div> <!-- col-lg-12 -->
</div>
+
 
<!-- row -->
+
</div> <!-- row -->
</div>
+
 
<!-- panel-body -->
+
</div> <!-- panel-body -->
</div>
+
 
<!-- panel panel‐default -->
+
</div> <!-- panel panel‐default -->
</div>
+
 
<!-- col-lg-12 -->
+
</div> <!-- col-lg-12 -->
</div>
+
 
<!-- row -->
+
</div> <!-- row -->
</div>
+
 
<!-- content -->
+
</div> <!-- content -->
</div> <!-- container -->
+
 
</body>
+
</div> <!-- container -->
 +
 
 +
</body>
 +
 
 
</html>
 
</html>

Revision as of 11:17, 11 September 2015

plasmid.js - Interactive plasmids

plasmid.js - Interactive plasmids

It is always cubersome to create vector maps, and then putting the static images on the web. We thought it would be a lot more fun to just autogenerate interactive plasmids dynamically from data. That's why we wrote plasmid.js, a JavaScript library to generate interactive vector maps for web pages.

Why should you use it?

It is dead simple to use!

The includes

    
    
    

The placeholders

    
Hover over an element to get more information!

The JavaScript


                $(function() {
            // You could also load your data via AJAX
            var inserts = [
            {
                size: 40, // Size in angles! (there are 360 of them available)
                color: "#0F0", // You can use any valid css format
                label: "GFP", // The label to display in the legend
                description: "Green Fluorescent Protein", // The description to put in the infobox
                gap: false, // If not given this defaults to true
                promoter: true // This is a promoter, defaults to false
            },
            {
                size: 10,
                color: "#F00",
                label: "Brow Fox",
                description: "He likes jumping over dogs.",
                gap: true
            },
            {
                size: 46,
                color: "#00F",
                label: "Lazy Dog",
                description: "He likes beeing jumpt over."
            },
            {
                size: 19,
                color: "#0FF",
                label: "Short one",
                description: "Wirklich, Wirklich kurz nun auch wieder nicht.",
                promoter: true
            },
            {
                size: 1,
                color: "#FF0",
                label: "Even shorter one",
                description: "Und knackig",
                gap: false,
                promoter: true
            }];

            // Required parameters are: id of the canvas, id of the infobox,
            // the inserts and the diameter of the plasmid. Note, that there
            // is spacing and a legend added (default: width + 575, height + 50)
            // These values can be changed easily, see below.
            var plasmid = new Plasmid('canvas', 'info', inserts, 500);
            plasmid.draw();
        });

Plus, it also looks great!

Hover over an element to get more information!

Further options

There are two ways to specify optional settings; you can either pass them via the constructor or set the corresponding attributes after the object is created (it's JavaScript, ...). Below you can see a annotated version of the constructor.


function Plasmid(canvas, infobox, inserts, diameter, legendWidth, insertWidth, defaultText, insertBoxAttr, fontSize, spacing, startAngle) {
    // Are all required parameters given?
    // [...]
    this.canvas = canvas; // The id of the canvas placeholder div
    this.inserts = inserts; // The array whith the given inserts (see above)
    this.diameter = diameter; // The diameter of the plasmid, this is *not* the size of the canvas
    this.infobox = infobox; // The id of the infobox to put the descriptions in

    // Set sane defaults for optional parameters
    this.legendWidth = legendWidth || 500; // The width of the legend
    this.radiusOfInsertBox = insertWidth || diameter / 13; // how "thick" the boxes of the inserts are drawn
    this.defaultText = defaultText || "Hover over an insert to get more information!"; // default text in infobox
    this.fontSize = fontSize || 20; // The font size for legend entries
    this.spacing = spacing || 25; // spacing is the number of pixels put above and below the plasmid and left to the legend
    this.startAngle = startAngle || -40; // The angle at which the first plasmid starts
    this.insertBoxAttr = insertBoxAttr || { // The attributes to set on the boxes representing an insert
        stroke: "#666",
        opacity: 0.7,
        "stroke-width": 1,
        "stroke-linejoin": "round"
    };

    // [...]
}