A place to cache linked articles (think custom and personal wayback machine)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <!doctype html><!-- This is a valid HTML5 document. -->
  2. <!-- Screen readers, SEO, extensions and so on. -->
  3. <html lang="fr">
  4. <!-- Has to be within the first 1024 bytes, hence before the <title>
  5. See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
  6. <meta charset="utf-8">
  7. <!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
  8. <!-- The viewport meta is quite crowded and we are responsible for that.
  9. See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
  10. <meta name="viewport" content="width=device-width,initial-scale=1">
  11. <!-- Required to make a valid HTML5 document. -->
  12. <title>DNA Chisel - a versatile sequence optimizer (archive) — David Larlet</title>
  13. <meta name="description" content="Publication mise en cache pour en conserver une trace.">
  14. <!-- That good ol' feed, subscribe :). -->
  15. <link rel="alternate" type="application/atom+xml" title="Feed" href="/david/log/">
  16. <!-- Generated from https://realfavicongenerator.net/ such a mess. -->
  17. <link rel="apple-touch-icon" sizes="180x180" href="/static/david/icons2/apple-touch-icon.png">
  18. <link rel="icon" type="image/png" sizes="32x32" href="/static/david/icons2/favicon-32x32.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="/static/david/icons2/favicon-16x16.png">
  20. <link rel="manifest" href="/static/david/icons2/site.webmanifest">
  21. <link rel="mask-icon" href="/static/david/icons2/safari-pinned-tab.svg" color="#07486c">
  22. <link rel="shortcut icon" href="/static/david/icons2/favicon.ico">
  23. <meta name="msapplication-TileColor" content="#f0f0ea">
  24. <meta name="msapplication-config" content="/static/david/icons2/browserconfig.xml">
  25. <meta name="theme-color" content="#f0f0ea">
  26. <!-- Documented, feel free to shoot an email. -->
  27. <link rel="stylesheet" href="/static/david/css/style_2020-06-19.css">
  28. <!-- See https://www.zachleat.com/web/comprehensive-webfonts/ for the trade-off. -->
  29. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  30. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  31. <link rel="preload" href="/static/david/css/fonts/triplicate_t4_poly_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" crossorigin>
  32. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_regular.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  33. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_bold.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  34. <link rel="preload" href="/static/david/css/fonts/triplicate_t3_italic.woff2" as="font" type="font/woff2" media="(prefers-color-scheme: dark)" crossorigin>
  35. <script>
  36. function toggleTheme(themeName) {
  37. document.documentElement.classList.toggle(
  38. 'forced-dark',
  39. themeName === 'dark'
  40. )
  41. document.documentElement.classList.toggle(
  42. 'forced-light',
  43. themeName === 'light'
  44. )
  45. }
  46. const selectedTheme = localStorage.getItem('theme')
  47. if (selectedTheme !== 'undefined') {
  48. toggleTheme(selectedTheme)
  49. }
  50. </script>
  51. <meta name="robots" content="noindex, nofollow">
  52. <meta content="origin-when-cross-origin" name="referrer">
  53. <!-- Canonical URL for SEO purposes -->
  54. <link rel="canonical" href="https://edinburgh-genome-foundry.github.io/DnaChisel/">
  55. <body class="remarkdown h1-underline h2-underline h3-underline hr-center ul-star pre-tick">
  56. <article>
  57. <header>
  58. <h1>DNA Chisel - a versatile sequence optimizer</h1>
  59. </header>
  60. <nav>
  61. <p class="center">
  62. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  63. <a href="https://edinburgh-genome-foundry.github.io/DnaChisel/" title="Lien vers le contenu original">Source originale</a>
  64. </p>
  65. </nav>
  66. <hr>
  67. <p>DNA Chisel (complete documentation <a class="reference external" href="https://edinburgh-genome-foundry.github.io/DnaChisel/">here</a>)
  68. is a Python library for optimizing DNA sequences with respect to a set of
  69. constraints and optimization objectives. It comes with over 15 classes of
  70. sequence specifications which can be composed to, for instance, codon-optimize
  71. genes, meet the constraints of a commercial DNA provider, avoid homologies
  72. between sequences, tune GC content, or all of this at once!</p>
  73. <p>DNA Chisel also allows users to define their own specifications in Python,
  74. making the library suitable for a large range of automated sequence design
  75. applications, and complex custom design projects. It can be used as a Python
  76. library, a command-line interface, or a <a class="reference external" href="https://cuba.genomefoundry.org/sculpt_a_sequence">web application</a>.</p>
  77. <div class="section" id="example-of-use">
  78. <h2>Example of use</h2>
  79. <div class="section" id="defining-a-problem-via-scripts">
  80. <h3>Defining a problem via scripts</h3>
  81. <p>In this basic example we generate a random sequence and optimize it so that</p>
  82. <ul class="simple">
  83. <li><p>It will be rid of BsaI sites.</p></li>
  84. <li><p>GC content will be between 30% and 70% on every 50bp window.</p></li>
  85. <li><p>The reading frame at position 500-1400 will be codon-optimized for <em>E. coli</em>.</p></li>
  86. </ul>
  87. <p>Here is the code to achieve that:</p>
  88. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">dnachisel</span> <span class="kn">import</span> <span class="o">*</span>
  89. <span class="c1"># DEFINE THE OPTIMIZATION PROBLEM</span>
  90. <span class="n">problem</span> <span class="o">=</span> <span class="n">DnaOptimizationProblem</span><span class="p">(</span>
  91. <span class="n">sequence</span><span class="o">=</span><span class="n">random_dna_sequence</span><span class="p">(</span><span class="mi">10000</span><span class="p">),</span>
  92. <span class="n">constraints</span><span class="o">=</span><span class="p">[</span>
  93. <span class="n">AvoidPattern</span><span class="p">(</span><span class="s2">"BsaI_site"</span><span class="p">),</span>
  94. <span class="n">EnforceGCContent</span><span class="p">(</span><span class="n">mini</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">maxi</span><span class="o">=</span><span class="mf">0.7</span><span class="p">,</span> <span class="n">window</span><span class="o">=</span><span class="mi">50</span><span class="p">),</span>
  95. <span class="n">EnforceTranslation</span><span class="p">(</span><span class="n">location</span><span class="o">=</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">1400</span><span class="p">))</span>
  96. <span class="p">],</span>
  97. <span class="n">objectives</span><span class="o">=</span><span class="p">[</span><span class="n">CodonOptimize</span><span class="p">(</span><span class="n">species</span><span class="o">=</span><span class="s1">'e_coli'</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">1400</span><span class="p">))]</span>
  98. <span class="p">)</span>
  99. <span class="c1"># SOLVE THE CONSTRAINTS, OPTIMIZE WITH RESPECT TO THE OBJECTIVE</span>
  100. <span class="n">problem</span><span class="o">.</span><span class="n">resolve_constraints</span><span class="p">()</span>
  101. <span class="n">problem</span><span class="o">.</span><span class="n">optimize</span><span class="p">()</span>
  102. <span class="c1"># PRINT SUMMARIES TO CHECK THAT CONSTRAINTS PASS</span>
  103. <span class="k">print</span><span class="p">(</span><span class="n">problem</span><span class="o">.</span><span class="n">constraints_text_summary</span><span class="p">())</span>
  104. <span class="k">print</span><span class="p">(</span><span class="n">problem</span><span class="o">.</span><span class="n">objectives_text_summary</span><span class="p">())</span>
  105. </pre></div>
  106. </div>
  107. <p>DnaChisel implements advanced constraints such as the preservation of coding
  108. sequences, or the inclusion or exclusion of advanced patterns (see
  109. <a class="reference external" href="https://edinburgh-genome-foundry.github.io/DnaChisel/ref/builtin_specifications.html">this page</a>
  110. for an overview of available specifications), but it is also easy to implement
  111. our own constraints and objectives as subclasses of <code class="docutils literal notranslate"><span class="pre">dnachisel.Specification</span></code>.</p>
  112. </div>
  113. <div class="section" id="defining-a-problem-via-genbank-features">
  114. <h3>Defining a problem via Genbank features</h3>
  115. <p>You can also define a problem by annotating directly a Genbank as follows:</p>
  116. <p align="center">
  117. <img alt="report" title="report" src="https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/DnaChisel/master/docs/_static/images/example_sequence_map.png">
  118. <br><br>
  119. </p><p>I this record:</p>
  120. <ul class="simple">
  121. <li><p>Constraints (colored in blue in the illustration) are features of type
  122. <code class="docutils literal notranslate"><span class="pre">misc_feature</span></code> with a prefix <code class="docutils literal notranslate"><span class="pre">@</span></code> followed
  123. by the name of the constraints and its parameters, which are the same as in
  124. python scripts.</p></li>
  125. <li><p>Optimization objectives (colored in yellow in the illustration) are features
  126. of type <code class="docutils literal notranslate"><span class="pre">misc_feature</span></code> with a prefix <code class="docutils literal notranslate"><span class="pre">~</span></code> followed by the name of the
  127. constraints and its parameters.</p></li>
  128. </ul>
  129. <p>The file can be directly fed to the <a class="reference external" href="https://cuba.genomefoundry.org/sculpt_a_sequence">web app</a>
  130. or processed via the command line interface:</p>
  131. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Output the result to "optimized_record.gb"</span>
  132. dnachisel annotated_record.gb optimized_record.gb
  133. </pre></div>
  134. </div>
  135. <p>Or via a Python script:</p>
  136. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">dnachisel</span> <span class="kn">import</span> <span class="n">DnaOptimizationProblem</span>
  137. <span class="n">problem</span> <span class="o">=</span> <span class="n">DnaOptimizationProblem</span><span class="o">.</span><span class="n">from_record</span><span class="p">(</span><span class="s2">"my_record.gb"</span><span class="p">)</span>
  138. <span class="n">problem</span><span class="o">.</span><span class="n">optimize_with_report</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="s2">"report.zip"</span><span class="p">)</span>
  139. </pre></div>
  140. </div>
  141. <p>By default, only the built-in specifications of DnaChisel can be used in the
  142. annotations, however it is easy to add your own specifications to the Genbank
  143. parser, and build applications supporting custom specifications on top of
  144. DnaChisel.</p>
  145. </div>
  146. <div class="section" id="reports">
  147. <h3>Reports</h3>
  148. <p>DnaChisel also implements features for verification and troubleshooting. For
  149. instance by generating optimization reports:</p>
  150. <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">problem</span><span class="o">.</span><span class="n">optimize_with_report</span><span class="p">(</span><span class="n">target</span><span class="o">=</span><span class="s2">"report.zip"</span><span class="p">)</span>
  151. </pre></div>
  152. </div>
  153. <p>Here is an example of summary report:</p>
  154. <p align="center">
  155. <img alt="report" title="report" src="https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/DnaChisel/master/docs/_static/images/report_screenshot.png">
  156. <br><br>
  157. </p></div>
  158. </div>
  159. <div class="section" id="how-it-works">
  160. <h2>How it works</h2>
  161. <p>DnaChisel hunts down every constraint breach and suboptimal region by
  162. recreating local version of the problem around these regions. Each type of
  163. constraint can be locally <em>reduced</em> and solved in its own way, to ensure fast
  164. and reliable resolution.</p>
  165. <p>Below is an animation of the algorithm in action:</p>
  166. <p align="center">
  167. <img alt="DNA Chisel algorithm" title="DNA Chisel" src="https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/DnaChisel/master/docs/_static/images/dnachisel_algorithm.gif">
  168. <br>
  169. </p></div>
  170. <div class="section" id="installation">
  171. <h2>Installation</h2>
  172. <p>You can install DnaChisel through PIP:</p>
  173. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">pip</span> <span class="n">install</span> <span class="n">dnachisel</span><span class="p">[</span><span class="n">reports</span><span class="p">]</span>
  174. </pre></div>
  175. </div>
  176. <p>The <code class="docutils literal notranslate"><span class="pre">[reports]</span></code> suffix will install some heavier libraries
  177. (Matplotlib, PDF reports, sequenticon) for report generation,
  178. you can omit it if you just want to use DNA chisel to edit sequences and
  179. generate genbanks (for any interactive use, reports are highly recommended).</p>
  180. <p>Alternatively, you can unzip the sources in a folder and type</p>
  181. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">install</span>
  182. </pre></div>
  183. </div>
  184. <p>Optionally, also install Bowtie to be able to use <code class="docutils literal notranslate"><span class="pre">AvoidMatches</span></code> (which
  185. removes short homologies with existing genomes). On Ubuntu:</p>
  186. <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">bowtie</span>
  187. </pre></div>
  188. </div>
  189. </div>
  190. <div class="section" id="more-biology-software">
  191. <h2>More biology software</h2>
  192. <a class="reference external image-reference" href="https://edinburgh-genome-foundry.github.io/"><img alt="https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Edinburgh-Genome-Foundry.github.io/master/static/imgs/logos/egf-codon-horizontal.png" src="https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Edinburgh-Genome-Foundry.github.io/master/static/imgs/logos/egf-codon-horizontal.png"></a>
  193. <p>DNA Chisel is part of the <a class="reference external" href="https://edinburgh-genome-foundry.github.io/">EGF Codons</a> synthetic biology software suite for DNA design, manufacturing and validation.</p>
  194. </article>
  195. <hr>
  196. <footer>
  197. <p>
  198. <a href="/david/" title="Aller à l’accueil">🏠</a> •
  199. <a href="/david/log/" title="Accès au flux RSS">🤖</a> •
  200. <a href="http://larlet.com" title="Go to my English profile" data-instant>🇨🇦</a> •
  201. <a href="mailto:david%40larlet.fr" title="Envoyer un courriel">📮</a> •
  202. <abbr title="Hébergeur : Alwaysdata, 62 rue Tiquetonne 75002 Paris, +33184162340">🧚</abbr>
  203. </p>
  204. <template id="theme-selector">
  205. <form>
  206. <fieldset>
  207. <legend>Thème</legend>
  208. <label>
  209. <input type="radio" value="auto" name="chosen-color-scheme" checked> Auto
  210. </label>
  211. <label>
  212. <input type="radio" value="dark" name="chosen-color-scheme"> Foncé
  213. </label>
  214. <label>
  215. <input type="radio" value="light" name="chosen-color-scheme"> Clair
  216. </label>
  217. </fieldset>
  218. </form>
  219. </template>
  220. </footer>
  221. <script>
  222. function loadThemeForm(templateName) {
  223. const themeSelectorTemplate = document.querySelector(templateName)
  224. const form = themeSelectorTemplate.content.firstElementChild
  225. themeSelectorTemplate.replaceWith(form)
  226. form.addEventListener('change', (e) => {
  227. const chosenColorScheme = e.target.value
  228. localStorage.setItem('theme', chosenColorScheme)
  229. toggleTheme(chosenColorScheme)
  230. })
  231. const selectedTheme = localStorage.getItem('theme')
  232. if (selectedTheme && selectedTheme !== 'undefined') {
  233. form.querySelector(`[value="${selectedTheme}"]`).checked = true
  234. }
  235. }
  236. const prefersColorSchemeDark = '(prefers-color-scheme: dark)'
  237. window.addEventListener('load', () => {
  238. let hasDarkRules = false
  239. for (const styleSheet of Array.from(document.styleSheets)) {
  240. let mediaRules = []
  241. for (const cssRule of styleSheet.cssRules) {
  242. if (cssRule.type !== CSSRule.MEDIA_RULE) {
  243. continue
  244. }
  245. // WARNING: Safari does not have/supports `conditionText`.
  246. if (cssRule.conditionText) {
  247. if (cssRule.conditionText !== prefersColorSchemeDark) {
  248. continue
  249. }
  250. } else {
  251. if (cssRule.cssText.startsWith(prefersColorSchemeDark)) {
  252. continue
  253. }
  254. }
  255. mediaRules = mediaRules.concat(Array.from(cssRule.cssRules))
  256. }
  257. // WARNING: do not try to insert a Rule to a styleSheet you are
  258. // currently iterating on, otherwise the browser will be stuck
  259. // in a infinite loop…
  260. for (const mediaRule of mediaRules) {
  261. styleSheet.insertRule(mediaRule.cssText)
  262. hasDarkRules = true
  263. }
  264. }
  265. if (hasDarkRules) {
  266. loadThemeForm('#theme-selector')
  267. }
  268. })
  269. </script>
  270. </body>
  271. </html>