raannakasturi commited on
Commit
d21fe3f
·
1 Parent(s): 9c9ffb4

Enhance post generation with improved Markmap integration and detailed summary sections in post_blog.py

Browse files
Files changed (1) hide show
  1. post_blog.py +124 -22
post_blog.py CHANGED
@@ -22,21 +22,30 @@ def generate_post_html(title, summary, mindmap, citation):
22
  image = fetch_image(title, summary, imgbb_api_key)
23
  html_summary = mistune.html(summary)
24
  post = f"""
25
- <div id="paper_post">
26
- <script src='https://cdn.jsdelivr.net/npm/markmap-toolbar@0.18.4/dist/index.min.js'/>
27
- <script async='async' src='https://cdn.jsdelivr.net/npm/markmap-autoloader@latest'/>
28
- <script>
 
 
 
 
 
 
 
 
 
29
  window.addEventListener(&#39;load&#39;, function() {{
30
- const element = document.querySelector(&#39;div.mm-toolbar-item[title=&quot;Fit window size&quot;]&#39;);
31
- if (element) {{
32
- element.click();
33
- }} else {{
34
- console.log(&#39;Element not found&#39;);
35
- }}
36
- }}, 500); // Adjust the delay if needed
 
37
  }});
38
  </script>
39
- <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
40
  <style>
41
  .markmap {{
42
  position: relative;
@@ -47,25 +56,118 @@ def generate_post_html(title, summary, mindmap, citation):
47
  height: 80dvh;
48
  }}
49
  </style>
50
- <img style='display:block; width:100%;height:100%;' id='paper_image' src='{image}' />
51
- </br>
52
  <b>{{getToc}} $title={{Table of Contents}}</b>
53
  <br>
54
- <p id="paper_summary">{html_summary.replace("&amp;", "&")}</p>
55
- </br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  <h2>Mindmap</h2>
57
  <p><small><em>If MindMap doesn't load, please refresh the page.</em></small></p>
58
- <div class="markmap" id="paper_mindmap">
59
  <script type="text/template">
60
- {mindmap.replace("&amp;", "&").replace(":", "=>")}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  </script>
62
  </div>
63
- </br>
64
  <h2>Citation</h2>
65
- <p id="paper_citation">
66
- {mistune.html(citation.replace("&amp;", "&"))}
67
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  </div>
 
69
  """
70
  return post, image
71
 
 
22
  image = fetch_image(title, summary, imgbb_api_key)
23
  html_summary = mistune.html(summary)
24
  post = f"""
25
+ <div id="paper_post">
26
+ <link href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.18.4/dist/index.min.js" rel="preload" as="script">
27
+ <script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.18.4/dist/index.min.js"></script>
28
+ <link href="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest" rel="preload" as="script">
29
+ <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
30
+ <script>
31
+ window.markmap = {{
32
+ autoLoader: {{
33
+ toolbar: true,
34
+ }},
35
+ }};
36
+ </script>
37
+ <script>
38
  window.addEventListener(&#39;load&#39;, function() {{
39
+ setTimeout(function() {{
40
+ const element = document.querySelector(&#39;div.mm-toolbar-item[title=&quot;Fit window size&quot;]&#39;);
41
+ if (element) {{
42
+ element.click();
43
+ }} else {{
44
+ console.log(&#39;Element not found&#39;);
45
+ }}
46
+ }}, 500);
47
  }});
48
  </script>
 
49
  <style>
50
  .markmap {{
51
  position: relative;
 
56
  height: 80dvh;
57
  }}
58
  </style>
59
+ <img style="display:block; width:100%; height:100%;" id="paper_image" src="https://i.ibb.co/7Khtx3z/c4deb6c41c04.jpg" alt="Research Paper Image">
60
+ <br>
61
  <b>{{getToc}} $title={{Table of Contents}}</b>
62
  <br>
63
+ <div id="paper_summary">
64
+ <h2>Summary</h2>
65
+ <p>The study resolves the order of amino acid recruitment into the genetic code by analyzing ancient protein domains from the last universal common ancestor (LUCA). The results show that smaller amino acids were added to the code earlier, and metal-binding and sulfur-containing amino acids were added earlier than previously thought.</p>
66
+ <h2>Highlights</h2>
67
+ <ul>
68
+ <li>The study analyzed 969 Pfams and 445 clans to determine the order of amino acid recruitment into the genetic code.</li>
69
+ <li>Smaller amino acids were found to be added to the code earlier.</li>
70
+ <li>Metal-binding and sulfur-containing amino acids were added earlier than previously thought.</li>
71
+ <li>The results suggest that the genetic code evolved in stages, with early amino acids present on Earth before the emergence of life.</li>
72
+ <li>The study proposes a revised order of amino acid recruitment, with glutamine being added later than previously thought.</li>
73
+ <li>The results have implications for understanding the origins of life and the evolution of the genetic code.</li>
74
+ <li>The study provides a new perspective on the evolution of the genetic code and the role of metal-binding and sulfur-containing amino acids.</li>
75
+ </ul>
76
+ <h2>Key Insights</h2>
77
+ <ul>
78
+ <li>The study's findings suggest that the genetic code evolved in response to the availability of amino acids on early Earth, with smaller amino acids being more readily available.</li>
79
+ <li>The early addition of metal-binding and sulfur-containing amino acids suggests that these amino acids played a crucial role in the emergence of life.</li>
80
+ <li>The revised order of amino acid recruitment proposed by the study has implications for understanding the evolution of the genetic code and the origins of life.</li>
81
+ <li>The study highlights the importance of considering the evolutionary history of protein domains when studying the genetic code.</li>
82
+ <li>The results of the study provide a new perspective on the evolution of the genetic code and the role of amino acids in the emergence of life.</li>
83
+ <li>The study's findings have implications for understanding the origins of life on Earth and the possibility of life on other planets.</li>
84
+ <li>The study demonstrates the importance of using ancient protein domains to study the evolution of the genetic code.</li>
85
+ </ul>
86
+ </div>
87
+ <br>
88
  <h2>Mindmap</h2>
89
  <p><small><em>If MindMap doesn't load, please refresh the page.</em></small></p>
90
+ <div class="markmap" id="paper_mindmap">
91
  <script type="text/template">
92
+ ## Introduction to Genetic Code
93
+ - Genetic code is a set of rules
94
+ - Used to translate DNA into proteins
95
+ - Essential for life and its diversity
96
+
97
+ ## Amino Acid Recruitment
98
+ - Smaller amino acids added first
99
+ - Metal-binding amino acids added early
100
+ - Sulfur-containing amino acids added early
101
+
102
+ ## Evolution of Genetic Code
103
+ - Genetic code evolved in stages
104
+ - Early code may have used few amino acids
105
+ - Code expansion allowed for complexity
106
+
107
+ ## Last Universal Common Ancestor (LUCA)
108
+ - LUCA contained genetic code precursors
109
+ - LUCA likely had simple protein structure
110
+ - LUCA's code was likely different from modern
111
+
112
+ ## Pre-LUCA and LUCA Comparison
113
+ - Pre-LUCA sequences show different patterns
114
+ - LUCA sequences more sophisticated folding
115
+ - Pre-LUCA may have used alternative codes
116
+
117
+ ## Amino Acid Frequency and Usage
118
+ - Amino acid frequency affects protein structure
119
+ - Usage patterns reveal evolutionary history
120
+ - Frequency and usage linked to code evolution
121
+
122
+ ## Genetic Code and Environment
123
+ - Early environment influenced code evolution
124
+ - Sulfur-rich environments may have played role
125
+ - Code adapted to changing environments
126
+
127
+ ## Origins of Life and Genetic Code
128
+ - Genetic code linked to life's origins
129
+ - Code evolution influenced by early life forms
130
+ - Understanding code helps understand life's origins
131
+
132
+ ## Genetic Code and Evolutionary History
133
+ - Code evolution reveals evolutionary history
134
+ - Changes in code reflect changes in life forms
135
+ - Code a key to understanding evolution
136
+
137
+ ## Conclusion
138
+ - Genetic code is complex and evolving
139
+ - Understanding code helps understand life
140
+ - Further research needed to uncover secrets
141
  </script>
142
  </div>
143
+ <br>
144
  <h2>Citation</h2>
145
+ <div id="paper_citation">
146
+ <p>Wehbi, S., Wheeler, A., Morel, B., Manepalli, N., Minh, B. Q., Lauretta, D. S., & Masel, J. (2024). Order of amino acid recruitment into the genetic code resolved by last universal common ancestor’s protein domains. In <em>Proceedings of the National Academy of Sciences</em> (Vol. 121, Issue 52). <em>Proceedings of the National Academy of Sciences</em>. https://doi.org/10.1073/pnas.2410311121</p>
147
+ </div>
148
+ <script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.18.4/dist/index.min.js"></script>
149
+ <script src="https://cdn.jsdelivr.net/npm/markmap-autoloader@latest"></script>
150
+ <script>
151
+ window.markmap = {{
152
+ autoLoader: {{
153
+ toolbar: true,
154
+ }},
155
+ }};
156
+ </script>
157
+ <script>
158
+ window.addEventListener(&#39;load&#39;, function() {{
159
+ setTimeout(function() {{
160
+ const element = document.querySelector(&#39;div.mm-toolbar-item[title=&quot;Fit window size&quot;]&#39;);
161
+ if (element) {{
162
+ element.click();
163
+ }} else {{
164
+ console.log(&#39;Element not found&#39;);
165
+ }}
166
+ }}, 500);
167
+ }});
168
+ </script>
169
  </div>
170
+
171
  """
172
  return post, image
173