Visualize DNA using chaos game
How do I make an visualize dna using chaos game?
Learn more about DNA driven chaos games here and here. What is a visualize dna using chaos game? How do you make a visualize dna using chaos game? This script and codes were developed by Mirjamsk on 26 January 2023, Thursday.
Visualize DNA using chaos game - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>visualize DNA using chaos game</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,' rel='stylesheet' type='text/css'> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class= "title"> <div> <img src="http://i58.tinypic.com/2im7uvc.png"></div> <div> <h1 > DNA + chaos game </h1> <div class="exampleDNA"> <mark> ✱ Don't know where to find some awesome DNA sequences to copy / paste? <a href="https://github.com/alojzije/visualize-dna/tree/master/exampleDNA" target="_blank"> Follow me!</a> </mark> </div> </div> </div> <div class="container" > <div id="inputContainer"> <div id="uploadContainer"> <input id="chosenFile" size="33" placeholder="load txt file containing DNA sequence" disabled="disabled" /> <div class="fileUpload btn"> <span>upload</span> <input id="dnaFileInput" type="file" class="upload" /> </div> </div> <br><br> <textarea id="dnaTextArea" rows="12" cols="40" placeholder=" . . . or enter / paste a DNA sequence here"></textarea><br> <input id="dnaTxtButton" type="button" class="btn" value=" visualize "> <span style="font-size:0.9em"> * Built with the amazing <a href="https://p5js.org/" target="_blank">p5.js</a></span> </div> <div id="canvasOuterContainer"> <div id="canvasContainer"> <div id="canvas_1"></div> <div id="canvas_3"></div> <div id="canvas_2"></div> <div id="canvas_4"></div> </div> </div> </div> <script src='http://cdn.jsdelivr.net/p5.js/0.3.2/p5.min.js'></script>
<script src='http://cdn.jsdelivr.net/p5.js/0.3.2/addons/p5.dom.js'></script> <script src="js/index.js"></script>
</body>
</html>
Visualize DNA using chaos game - Script Codes CSS Codes
body, html{ padding:0; margin:0; margin-left: 3%; font-size: 16px; font-family: 'Open Sans', 'Bitter', serif;
}
.title h1{ color: #111; font-size: 3.5em; font-family: 'Open Sans', 'Bitter', serif;
}
.title > div { display: inline-block; vertical-align: middle;
} .title img{ margin: 2.2em 0.5em 0.2em 0;
}
#canvasOuterContainer{ width: 50%; min-width: 360px; display: inline-block; float: right;
}
#canvasContainer{ width: 350px; min-width: 350px; height: 350px; display: inline-block; margin: 0 auto;
}
#canvasContainer >div{ width: 171px; height: 171px; background-color: #ddd; display: inline-block;
}
#inputContainer{ min-width: 20em; margin-right: 2em; display: inline-block;
}
#uploadContainer{ min-width: 20em; display: inline-block; float: left;
}
.container { width: 100%; margin-top: 4.5em;
}
#canvas_4{ background: url(http://i57.tinypic.com/vg25a9.png); background-size: 100% 100%; background-repeat: no-repeat;
}
.exampleDNA{ letter-spacing: 0.04em; background-color: rgba( 255,170,0, 0.7); padding: 0.5em; font-size: 0.9em;
}
mark{ border-top: 1px solid #222; border-bottom: 1px solid #222; background-color: rgba( 255,170,0, 0.0);
}
.fileUpload { position: relative; overflow: hidden; background-color: #fff; border: 1px solid #333; margin: 0 0 0.5em 0.6em;
}
.fileUpload input.upload { position: absolute; width: 100%; height: 100%; top: 0; right: 0; margin: 0; padding: 0; cursor: pointer; opacity: 0; filter: alpha(opacity=0);
}
#chosenFile{ color: #666; border: none; border-bottom: 1px solid #333; background-color: #fff;
}
#dnaTextArea{ border: 1px solid #333; resize: vertical; padding: 0.5em 0.2em 0em 0.2em; min-width: 20em;
}
#dnaTxtButton{ margin-top: 0.9em; padding: 0.6em 1em; outline: none; background-color: rgba(255,255,255,0); border: 1px solid #333;
}
@media screen and (max-width: 1000px){ #canvasOuterContainer{ margin-top: 5em; float: left;
}
Visualize DNA using chaos game - Script Codes JS Codes
var lines = '';
var p5_1, p5_2, p5_3;
var visualizeCounter = -1;
window.onload = function(){ var visualizeBtn = document.getElementById('dnaTxtButton'); var dnaFileInput = document.getElementById('dnaFileInput'); var dnaTextArea = document.getElementById('dnaTextArea'); var chosenFile = document.getElementById("chosenFile"); chosenFile.value = ''; dnaTextArea.value = ''; dnaFileInput.value = ''; dnaFileInput.addEventListener('change', function(e){ chosenFile.value = dnaFileInput.value; dnaTextArea.value = ''; var file = dnaFileInput.files[0]; if(file.type.match(/text.*/)){ var reader = new FileReader(); reader.onload = function(e){ lines = reader.result; }; reader.readAsText(file); } }); visualizeBtn.addEventListener('click',function(e) { e.preventDefault(); visualizeCounter = (++visualizeCounter)%3; if(dnaTextArea.value !== ''){ lines = dnaTextArea.value; dnaFileInput.value = ''; chosenFile.value = ''; } switch(visualizeCounter){ case 0: if(!p5_1) p5_1 = new p5(s, 'canvas_1'); else redraw1(p5_1); break; case 2: if(!p5_2) { p5_2 = new p5(s, 'canvas_2'); p5_2.stroke(255, 128, 128, 80); } else redraw1(p5_2); break; default: if(!p5_3) { p5_3 = new p5(s, 'canvas_3'); p5_3.stroke(244, 115, 61, 80); } else redraw1(p5_3); } });
};
function redraw1(myp5){ myp5.clear(); myp5.background(200); myp5.loop(); myp5.redraw();
}
var s = function(sketch){ var xbound = 170; var ybound = 170; var px = xbound/2; var py = ybound/2; var aminoacid = ''; var i = 0; sketch.setup = function() { // put setup code here sketch.createCanvas(170,170); sketch.strokeWeight(2); sketch.stroke(0, 128, 128, 80); sketch.background(200); // noLoop(); }; sketch.draw = function (){ var cnt = 50; while(--cnt){ aminoacid = lines.charAt(i).toUpperCase(); switch(aminoacid){ case 'A': px = px/2; py = (py+ybound)/2; break; case 'T': case 'U': px = (px+xbound)/2; py = (py+ybound)/2; break; case 'G': px = (px+xbound)/2; py = py/2; break; case 'C': px = px/2; py = py/2; break; default: break; } if(++i >= lines.length){ sketch.noLoop(); i = 0; break; } sketch.point(parseInt(px),parseInt(py)); } };
};
Developer | Mirjamsk |
Username | alojzije |
Uploaded | January 26, 2023 |
Rating | 3 |
Size | 3,971 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Materialize pagination | 2,236 Kb |
Gravity simulation | 4,699 Kb |
Horizontal slider | 2,672 Kb |
Connect html elements with SVG path | 4,232 Kb |
Horizontal slider on scroll | 2,672 Kb |
Search it | 3,338 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Haml Calendar | Katydecorah | 5,643 Kb |
Zeichensatz | Moklick | 2,058 Kb |
Modal Dialog | Gigaleet | 2,251 Kb |
Animated Donut Chart | Jplhomer | 3,808 Kb |
Simple Linear Regression with Editable Table | Melatonind | 3,264 Kb |
Midterm dry run | Jds317 | 1,649 Kb |
Pure CSS candle light animation by One element | Ksksoft | 2,193 Kb |
Importable Clearfix | Corysimmons | 1,411 Kb |
React Markdown Previewer | C0d0er | 3,190 Kb |
Custom Select Element | Agrayson | 3,616 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!