Repository 'riboplot'
hg clone https://toolshed.g2.bx.psu.edu/repos/vimalkumarvelayudhan/riboplot

Changeset 11:7571f5c89090 (2015-08-19)
Previous changeset 10:8964641b04ef (2015-08-17) Next changeset 12:61c47a1d6a7a (2015-08-19)
Commit message:
Simple error message now output to HTML. Detailed error goes to standard error. Other changes: * Remove information on time taken (riboplot). * Remove striped table styles (not used. unusable on sorting). * log before re-raising errors.
modified:
.hgignore
data/ribocount.html
riboplot.egg-info/PKG-INFO
riboplot.egg-info/SOURCES.txt
riboplot/__init__.py
riboplot/ribocore.py
riboplot/ribocount.py
riboplot/riboplot.py
added:
docs/_static/alabaster.css_t
docs/_styles/custom.style
docs/_styles/fonts/Cabin-Bold.ttf
docs/_styles/fonts/Cabin-BoldItalic.ttf
docs/_styles/fonts/Cabin-Italic.ttf
docs/_styles/fonts/Cabin-Regular.ttf
docs/_styles/fonts/SourceSansPro-Bold.ttf
docs/_styles/fonts/SourceSansPro-BoldItalic.ttf
docs/_styles/fonts/SourceSansPro-Italic.ttf
docs/_styles/fonts/SourceSansPro-Regular.ttf
docs/_templates/about.html
docs/_templates/layout.html
docs/_templates/searchbox.html
docs/modules.rst
docs/riboplot.rst
run_coverage.sh
b
diff -r 8964641b04ef -r 7571f5c89090 .hgignore
--- a/.hgignore Mon Aug 17 10:51:58 2015 +0100
+++ b/.hgignore Wed Aug 19 10:14:52 2015 +0100
b
@@ -2,5 +2,12 @@
 *.pyc
 *.swp
 .git*
+.ropeproject
+.coverage
+build
+dist
+docs/_build
+htmlcov
 tests/data/*.bam*
 tests/data/*.fna*
+riboplot/riboplot_multi.py
b
diff -r 8964641b04ef -r 7571f5c89090 data/ribocount.html
--- a/data/ribocount.html Mon Aug 17 10:51:58 2015 +0100
+++ b/data/ribocount.html Wed Aug 19 10:14:52 2015 +0100
b
@@ -53,7 +53,6 @@
                 {table_content}
                 </tbody>
             </table>
-            <p class="text-muted">Time taken for generating counts (H:MM:SS): {duration}</p>
         </div>
     </div>
 </div>
@@ -61,4 +60,4 @@
 <script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
 <script type="text/javascript" src="js/custom.js"></script>
 </body>
-</html>
\ No newline at end of file
+</html>
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_static/alabaster.css_t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_static/alabaster.css_t Wed Aug 19 10:14:52 2015 +0100
[
b'@@ -0,0 +1,612 @@\n+{% set sidebar_width = \'300px\' %}\n+\n+{% set theme_sidebar_header = theme_sidebar_header or theme_gray_1 %}\n+{% set theme_sidebar_link = theme_sidebar_link or theme_gray_1 %}\n+{% set theme_anchor_hover_fg = theme_anchor_hover_fg or theme_gray_1 %}\n+\n+{% set theme_note_bg = theme_note_bg or theme_gray_2 %}\n+{% set theme_footnote_border = theme_footnote_border or theme_gray_2 %}\n+{% set theme_pre_bg = theme_pre_bg or theme_gray_2 %}\n+\n+{% set theme_warn_bg = theme_warn_bg or theme_pink_1 %}\n+{% set theme_warn_border = theme_warn_border or theme_pink_2 %}\n+\n+{% set theme_seealso_bg = theme_seealso_bg or theme_gray_2 %}\n+\n+{% set theme_narrow_sidebar_link = theme_narrow_sidebar_link or theme_gray_3 %}\n+{% set theme_sidebar_hr = theme_sidebar_hr or theme_gray_3 %}\n+\n+\n+@import url("basic.css");\n+\n+/* -- page layout ----------------------------------------------------------- */\n+\n+html {\n+    position: relative;\n+    min-height: 100%;\n+}\n+\n+body {\n+    font-family: {{ theme_font_family }};\n+    font-weight: 300;\n+    font-size: 18px;\n+    line-height: 1.6;\n+    background-color: #ffffff;\n+    color: #333;\n+    margin: 20px 0px 50px 0px;\n+    padding: 0;\n+}\n+\n+div.document {\n+    margin: 0px 30px;\n+}\n+\n+div.documentwrapper {\n+    float: left;\n+    width: 100%;\n+}\n+\n+div.bodywrapper {\n+    margin: 0 0 0 320px;\n+    padding-left: 1px;\n+    border-left: 1px dotted #f0f0f0;\n+}\n+\n+div.sphinxsidebar {\n+    width: {{ sidebar_width }};\n+}\n+\n+hr {\n+    border: 1px solid #B1B4B6;\n+}\n+\n+div.body {\n+    background-color: #ffffff;\n+    color: {{ theme_body_text }};\n+    padding: 0 30px 0 30px;\n+}\n+\n+div.footer {\n+    position: absolute;\n+    bottom: 0;\n+    width: 100%;\n+    height: 50px;\n+    font-size: 0.4em;\n+    color: {{ theme_footer_text }};\n+    text-align: center;\n+}\n+\n+div.footer a {\n+    color: {{ theme_footer_text }};\n+}\n+\n+div.related {\n+    display: none;\n+}\n+\n+div.sphinxsidebar a {\n+    color: {{ theme_link }};\n+    text-decoration: none;\n+    /*border-bottom: 1px dotted {{ theme_sidebar_link_underscore }};*/\n+}\n+\n+div.sphinxsidebar a:hover {\n+    border-bottom: 1px solid {{ theme_sidebar_link_underscore }};\n+}\n+\n+div.sphinxsidebar {\n+    font-size: 16px;\n+    line-height: 1.5;\n+}\n+\n+div.sphinxsidebarwrapper {\n+    padding: 18px 10px;\n+}\n+\n+div.sphinxsidebarwrapper p.logo {\n+    padding: 0;\n+    margin: -10px 0 0 0px;\n+    text-align: center;\n+}\n+\n+div.sphinxsidebarwrapper h1.logo {\n+    margin-top: -10px;\n+    text-align: center;\n+    margin-bottom: 20px;\n+    text-align: {{ theme_logo_text_align }};\n+    font-family: {{ theme_head_font_family }}\n+}\n+\n+div.sphinxsidebarwrapper h1.logo-name {\n+    margin-top: 0px;\n+}\n+\n+div.sphinxsidebarwrapper p.blurb {\n+    margin-top: 0;\n+    font-style: {{ theme_description_font_style }};\n+}\n+\n+div.sphinxsidebar h3,\n+div.sphinxsidebar h4 {\n+    font-family: {{ theme_head_font_family }};\n+    color: {{ theme_sidebar_header }};\n+    font-size: 24px;\n+    font-weight: normal;\n+    margin: 0 0 5px 0;\n+    padding: 0;\n+}\n+\n+div.sphinxsidebar h4 {\n+    font-size: 20px;\n+}\n+\n+div.sphinxsidebar h3 a {\n+    color: {{ theme_link }};\n+}\n+\n+div.sphinxsidebar p.logo a,\n+div.sphinxsidebar h3 a,\n+div.sphinxsidebar p.logo a:hover,\n+div.sphinxsidebar h3 a:hover {\n+    border: none;\n+}\n+\n+div.sphinxsidebar p {\n+    color: {{ theme_sidebar_text }};\n+    margin: 10px 0;\n+}\n+\n+div.sphinxsidebar ul {\n+    margin: 10px 0;\n+    padding: 0;\n+    color: {{ theme_sidebar_list }};\n+}\n+\n+div.sphinxsidebar ul li.toctree-l1 > a {\n+    font-size: 120%;\n+}\n+\n+div.sphinxsidebar ul li.toctree-l2 > a {\n+    font-size: 110%;\n+}\n+\n+div.sphinxsidebar input {\n+    border: 1px solid {{ theme_sidebar_search_button }};\n+    font-family: {{ theme_font_family }};\n+    font-size: 1.1em;\n+}\n+\n+div.sphinxsidebar hr {\n+    border: none;\n+    height: 1px;\n+    color: {{ theme_sidebar_link_underscore }};\n+    background: {{ theme_sidebar_link_underscore }};\n+\n+    text-align: left;\n+    margin-left: 0;\n+    width: 50%;\n+}\n+\n+/'..b'dding: 0;\n+}\n+\n+ul, ol {\n+    margin: 10px 0 10px 30px;\n+    padding: 0;\n+}\n+\n+pre {\n+    background: {{ theme_pre_bg }};\n+    padding: 7px 30px;\n+    margin: 15px 0px;\n+    line-height: 1.3em;\n+}\n+\n+dl pre, blockquote pre, li pre {\n+    margin-left: -60px;\n+    padding-left: 60px;\n+}\n+\n+dl dl pre {\n+    margin-left: -90px;\n+    padding-left: 90px;\n+}\n+\n+tt, code {\n+    background-color: {{ theme_pre_bg }};\n+    color: #444;\n+    /* padding: 1px 2px; */\n+}\n+\n+tt.xref, code.xref, a tt {\n+    background-color: #FBFBFB;\n+    border-bottom: 1px solid white;\n+}\n+\n+a.reference {\n+    text-decoration: none;\n+    color: {{ theme_link }}\n+}\n+\n+a.reference:hover {\n+    color: {{ theme_link_hover }};\n+    border-bottom: 1px solid {{ theme_link_hover }};\n+}\n+\n+a.footnote-reference {\n+    text-decoration: none;\n+    font-size: 0.7em;\n+    vertical-align: top;\n+    border-bottom: 1px dotted {{ theme_link }};\n+}\n+\n+a.footnote-reference:hover {\n+    border-bottom: 1px solid {{ theme_link_hover }};\n+}\n+\n+a:hover tt, a:hover code {\n+    background: #EEE;\n+}\n+\n+\n+@media screen and (max-width: 870px) {\n+\n+    div.sphinxsidebar {\n+    \tdisplay: none;\n+    }\n+\n+    div.document {\n+       width: 100%;\n+\n+    }\n+\n+    div.documentwrapper {\n+    \tmargin-left: 0;\n+    \tmargin-top: 0;\n+    \tmargin-right: 0;\n+    \tmargin-bottom: 0;\n+    }\n+\n+    div.bodywrapper {\n+    \tmargin-top: 0;\n+    \tmargin-right: 0;\n+    \tmargin-bottom: 0;\n+    \tmargin-left: 0;\n+        border-left: 0px;\n+    }\n+\n+    ul {\n+    \tmargin-left: 0;\n+    }\n+\n+    .document {\n+    \twidth: auto;\n+    }\n+\n+    .footer {\n+    \twidth: auto;\n+    }\n+\n+    .bodywrapper {\n+    \tmargin: 0;\n+    }\n+\n+    .footer {\n+    \twidth: auto;\n+    }\n+\n+    .github {\n+        display: none;\n+    }\n+\n+\n+\n+}\n+\n+\n+\n+@media screen and (max-width: 875px) {\n+\n+    body {\n+        margin: 0;\n+        padding: 20px 30px;\n+    }\n+\n+    div.documentwrapper {\n+        float: none;\n+        background: white;\n+    }\n+\n+    div.sphinxsidebar {\n+        display: block;\n+        float: none;\n+        width: 102.5%;\n+        margin: 50px -30px -20px -30px;\n+        padding: 10px 20px;\n+        background: {{ theme_narrow_sidebar_bg }};\n+        color: {{ theme_narrow_sidebar_fg }};\n+    }\n+\n+    div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p,\n+    div.sphinxsidebar h3 a {\n+        color: white;\n+    }\n+\n+    div.sphinxsidebar a {\n+        color: {{ theme_narrow_sidebar_link }};\n+    }\n+\n+    div.sphinxsidebar p.logo {\n+        display: none;\n+    }\n+\n+    div.document {\n+        width: 100%;\n+        margin: 0;\n+    }\n+\n+    div.related {\n+        display: block;\n+        margin: 0;\n+        padding: 10px 0 20px 0;\n+    }\n+\n+    div.related ul,\n+    div.related ul li {\n+        margin: 0;\n+        padding: 0;\n+    }\n+\n+    div.footer {\n+        display: none;\n+    }\n+\n+    div.bodywrapper {\n+        margin: 0;\n+    }\n+\n+    div.body {\n+        min-height: 0;\n+        padding: 0;\n+    }\n+\n+    .rtd_doc_footer {\n+        display: none;\n+    }\n+\n+    .document {\n+        width: auto;\n+    }\n+\n+    .footer {\n+        width: auto;\n+    }\n+\n+    .footer {\n+        width: auto;\n+    }\n+\n+    .github {\n+        display: none;\n+    }\n+}\n+\n+\n+/* misc. */\n+\n+.revsys-inline {\n+    display: none!important;\n+}\n+\n+/* Make nested-list/multi-paragraph items look better in Releases changelog\n+ * pages. Without this, docutils\' magical list fuckery causes inconsistent\n+ * formatting between different release sub-lists.\n+ */\n+div#changelog > div.section > ul > li > p:only-child {\n+    margin-bottom: 0;\n+}\n+\n+/* Hide fugly table cell borders in ..bibliography:: directive output */\n+table.docutils.citation, table.docutils.citation td, table.docutils.citation th {\n+  border:none;\n+}\n+\n+#searchbox {\n+    margin-top: 1.5em;\n+    margin-bottom: 1.5em;\n+}\n+\n+div.sphinxsidebar #searchbox input[type="text"] {\n+    width: 220px;\n+}\n+\n+div.sphinxsidebar #searchbox input[type="submit"] {\n+    width: 40px;\n+}\n\\ No newline at end of file\n'
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/custom.style
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_styles/custom.style Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,33 @@
+  {
+  "fontsAlias" : {
+    "stdFont": "Open Sans :style=Regular",
+    "stdBold": "Open Sans :style=Bold",
+    "stdItalic": "Open Sans :style=Italic",
+    "stdBoldItalic": "Open Sans :style=Bold Italic",
+    "stdMono": "Source Code Pro",
+    "stdMonoItalic": "Source Code Pro",
+    "stdMonoBold": "Source Code Pro",
+    "stdMonoBoldItalic": "Source Code Pro"
+  },
+  "styles": {
+    "base": {
+        "leading": 14
+    },
+    "literal": {
+        "backColor": "#fffce6",
+        "fontSize": 9
+    },
+    "code": {
+        "backColor": "#f9f9f9",
+        "borderColor": "#f1f1f1",
+        "fontSize": 9
+    },
+    "admonition": {
+        "backColor": "#f9f9f9"
+    },
+    "note": {
+        "backColor": "#e6f7ff",
+        "borderColor": "#ccefff"
+    }
+  }
+ }
\ No newline at end of file
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/Cabin-Bold.ttf
b
Binary file docs/_styles/fonts/Cabin-Bold.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/Cabin-BoldItalic.ttf
b
Binary file docs/_styles/fonts/Cabin-BoldItalic.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/Cabin-Italic.ttf
b
Binary file docs/_styles/fonts/Cabin-Italic.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/Cabin-Regular.ttf
b
Binary file docs/_styles/fonts/Cabin-Regular.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/SourceSansPro-Bold.ttf
b
Binary file docs/_styles/fonts/SourceSansPro-Bold.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/SourceSansPro-BoldItalic.ttf
b
Binary file docs/_styles/fonts/SourceSansPro-BoldItalic.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/SourceSansPro-Italic.ttf
b
Binary file docs/_styles/fonts/SourceSansPro-Italic.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_styles/fonts/SourceSansPro-Regular.ttf
b
Binary file docs/_styles/fonts/SourceSansPro-Regular.ttf has changed
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_templates/about.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_templates/about.html Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,1 @@
+<h1 class="logo"><a href="{{ pathto(master_doc) }}">{{ project }}</a></h1>
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_templates/layout.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_templates/layout.html Wed Aug 19 10:14:52 2015 +0100
[
@@ -0,0 +1,53 @@
+{%- extends "basic/layout.html" %}
+{%- block extrahead %}
+  {{ super() }}
+  {% if theme_touch_icon %}
+    <link rel="apple-touch-icon" href="{{ pathto('_static/' ~ theme_touch_icon, 1) }}" />
+  {% endif %}
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
+{% endblock %}
+{%- block relbar2 %}{% endblock %}
+{%- block footer %}
+    <div class="footer">
+       <small>
+        {%- if last_updated %}
+        {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
+        {%- endif %}
+        </small>
+
+      {% if theme_show_powered_by|lower == 'true' %}
+      |
+      Powered by <a href="http://sphinx-doc.org/">Sphinx {{ sphinx_version }}</a>
+      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster {{ alabaster_version }}</a>
+      {% endif %}
+      {%- if show_source and has_source and sourcename %}
+      |
+      <a href="{{ pathto('_sources/' + sourcename, true)|e }}"
+          rel="nofollow">{{ _('Page source') }}</a></li>
+      {%- endif %}
+    </div>
+
+    {% if theme_github_banner|lower != 'false' %}
+    <a href="https://github.com/{{ theme_github_user }}/{{ theme_github_repo }}" class="github">
+        <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ pathto('_static/' ~ theme_github_banner, 1) if theme_github_banner|lower != 'true' else 'http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png' }}" alt="Fork me on GitHub"  class="github"/>
+    </a>
+    {% endif %}
+
+    {% if theme_analytics_id %}
+    <script type="text/javascript">
+
+      var _gaq = _gaq || [];
+      _gaq.push(['_setAccount', '{{ theme_analytics_id }}']);
+      _gaq.push(['_setDomainName', 'none']);
+      _gaq.push(['_setAllowLinker', true]);
+      _gaq.push(['_trackPageview']);
+
+      (function() {
+        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+      })();
+
+    </script>
+    {% endif %}
+{%- endblock %}
b
diff -r 8964641b04ef -r 7571f5c89090 docs/_templates/searchbox.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_templates/searchbox.html Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,21 @@
+{#
+    basic/searchbox.html
+    ~~~~~~~~~~~~~~~~~~~~
+
+    Sphinx sidebar template: quick search box.
+
+    :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+#}
+{%- if pagename != "search" and builder != "singlehtml" %}
+<div id="searchbox" style="display: none" role="search">
+  <!--<h3>{{ _('Search') }}</h3>-->
+    <form class="search" action="{{ pathto('search') }}" method="get">
+      <input type="text" name="q" placeholder="Search"/>
+      <input type="submit" value="{{ _('Go') }}" />
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+{%- endif %}
b
diff -r 8964641b04ef -r 7571f5c89090 docs/modules.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/modules.rst Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,7 @@
+riboplot
+========
+
+.. toctree::
+   :maxdepth: 4
+
+   riboplot
b
diff -r 8964641b04ef -r 7571f5c89090 docs/riboplot.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/riboplot.rst Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,54 @@
+riboplot package
+================
+
+Submodules
+----------
+
+riboplot.config module
+----------------------
+
+.. automodule:: riboplot.config
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+riboplot.ribocore module
+------------------------
+
+.. automodule:: riboplot.ribocore
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+riboplot.ribocount module
+-------------------------
+
+.. automodule:: riboplot.ribocount
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+riboplot.riboplot module
+------------------------
+
+.. automodule:: riboplot.riboplot
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+riboplot.riboplot_multi module
+------------------------------
+
+.. automodule:: riboplot.riboplot_multi
+    :members:
+    :undoc-members:
+    :show-inheritance:
+
+
+Module contents
+---------------
+
+.. automodule:: riboplot
+    :members:
+    :undoc-members:
+    :show-inheritance:
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot.egg-info/PKG-INFO
--- a/riboplot.egg-info/PKG-INFO Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot.egg-info/PKG-INFO Wed Aug 19 10:14:52 2015 +0100
b
@@ -27,7 +27,7 @@
         **ribocount**
             Output read counts for all transcripts in an alignment.
         
-        For help on using these programs, please refer to :doc:`usage`.
+        For help on using these programs, please refer to :ref:`usage`.
         
         
         Free software: BSD license.
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot.egg-info/SOURCES.txt
--- a/riboplot.egg-info/SOURCES.txt Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot.egg-info/SOURCES.txt Wed Aug 19 10:14:52 2015 +0100
b
@@ -32,6 +32,10 @@
 riboplot.egg-info/top_level.txt
 tests/__init__.py
 tests/test_riboplot.py
+tests/.ropeproject/config.py
+tests/.ropeproject/globalnames
+tests/.ropeproject/history
+tests/.ropeproject/objectdb
 tests/data/5hRPF.bam
 tests/data/5hRPF.bam.bai
 tests/data/5hRPFsorted.bam
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot/__init__.py
--- a/riboplot/__init__.py Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot/__init__.py Wed Aug 19 10:14:52 2015 +0100
b
@@ -2,4 +2,4 @@
 
 __author__ = 'Vimalkumar Velayudhan'
 __email__ = 'vimalkumarvelayudhan@gmail.com'
-__version__ = '0.1.0'
\ No newline at end of file
+__version__ = '0.1.0'
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot/ribocore.py
--- a/riboplot/ribocore.py Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot/ribocore.py Wed Aug 19 10:14:52 2015 +0100
[
@@ -4,6 +4,19 @@
 import subprocess
 
 
+# create logger for the entire program
+log = logging.getLogger('riboplot')
+log.setLevel(logging.DEBUG)
+
+# create console handler with a higher log level
+ch = logging.StreamHandler()
+ch.setLevel(logging.INFO)
+
+formatter = logging.Formatter('%(asctime)s - %(module)s %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
+ch.setFormatter(formatter)
+log.addHandler(ch)
+
+
 class ArgumentError(Exception):
     """Raised when invalid arguments are sent in the command line."""
     pass
@@ -33,6 +46,8 @@
         f = pysam.AlignmentFile(bam_file)
     except ValueError:
         raise
+    except:
+        raise
     else:
         f.close()
 
@@ -95,7 +110,9 @@
         try:
             sequence, length = f.fetch(transcript), f.get_reference_length(transcript)
         except KeyError:
-            raise ArgumentError('Transcript "{}" does not exist in FASTA file "{}"'.format(transcript, fasta))
+            msg = 'Transcript "{}" does not exist in transcriptome FASTA file'.format(transcript)
+            log.error(msg)
+            raise ArgumentError(msg)
         records[transcript] = {'sequence': sequence, 'length': length}
     f.close()
     return records
@@ -129,38 +146,41 @@
 
     return read_counts, total_reads
 
+
 def check_required_arguments(ribo_file, transcriptome_fasta, transcript_name=None):
     """Check required arguments of both riboplot and ribocount."""
     # Is this a valid BAM file? i.e., can pysam read it?
     try:
         is_bam_valid(ribo_file)
     except ValueError:
-        logging.error('The given RiboSeq BAM file is not valid')
+        log.error('The given RiboSeq BAM file is not valid')
         raise
 
     # Does the BAM file have an index? If not, create it.
     if not bam_has_index(ribo_file):
-        logging.info('Creating an index for the BAM file...')
+        log.info('Creating an index for the BAM file...')
         create_bam_index(ribo_file)
 
     # Is FASTA file valid?
     try:
         fasta_valid = is_fasta_valid(transcriptome_fasta)
     except IOError:
-        logging.error('This FASTA file is not valid -> {}'.format(transcriptome_fasta))
+        log.error('Transcriptome FASTA file is not valid')
+        raise
 
     if fasta_valid and transcript_name:
         try:
             get_fasta_records(transcriptome_fasta, [transcript_name])
         except IOError:
-            logging.error('This FASTA file is not valid -> {}'.format(transcriptome_fasta))
-            raise
-        except ArgumentError:  # does transcript exist in fasta?
+            log.error('Transcriptome FASTA file is not valid')
             raise
 
         with pysam.AlignmentFile(ribo_file, 'rb') as bam_file:
             if transcript_name not in bam_file.references:
-                raise ArgumentError('Transcript "{}" does not exist in BAM file'.format(transcript_name))
+                msg = 'Transcript "{}" does not exist in BAM file'.format(transcript_name)
+                log.error(msg)
+                raise ArgumentError(msg)
+
 
 def check_optional_arguments(ribo_file, read_length=None, read_offset=None, rna_file=None):
     """Check all optional arguments."""
@@ -168,28 +188,33 @@
         try:
             subprocess.check_output(['bedtools', '--version'])
         except OSError:
-            logging.error('Could not find bedtools in PATH. bedtools is '
-                          'required for generating RNA coverage plot.')
+            log.error('Could not find bedtools in PATH. bedtools is required'
+                      'for generating RNA coverage plot.')
             raise
         # Is this a valid BAM file? i.e., can pysam read it?
         try:
             is_bam_valid(rna_file)
         except ValueError:
-            logging.error('The given RNASeq BAM file is not valid')
+            log.error('The given RNASeq BAM file is not valid')
             raise
 
     # If read_length is given, it must be a positive integer or reads of that
     # length must exist in the BAM file
     if read_length:
         if read_length < 0:
-            raise ArgumentError('Read length must be a positive value')
+            msg = 'Read length must be a positive value'
+            log.error(msg)
+            raise ArgumentError(msg)
 
         bam_read_lengths = get_bam_read_lengths(ribo_file)
         if read_length not in bam_read_lengths:
-            raise ArgumentError('Reads of the length "{}" does not exist in the BAM file'.format(read_length))
+            msg = 'Reads of the length "{}" does not exist in the BAM file'.format(read_length)
+            log.error(msg)
+            raise ArgumentError(msg)
 
     # If read_offset is given, it must be a positive integer
     if read_offset:
         if read_offset < 0:
-            raise ArgumentError('Read offset must be 0 or greater')
-
+            msg = 'Read offset must be 0 or greater'
+            log.error(msg)
+            raise ArgumentError(msg)
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot/ribocount.py
--- a/riboplot/ribocount.py Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot/ribocount.py Wed Aug 19 10:14:52 2015 +0100
[
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+"""ribocount"""
 import sys
 
 # check dependencies
@@ -14,7 +15,6 @@
 import zipfile
 import logging
 import argparse
-from datetime import datetime
 
 import ribocore
 import config
@@ -22,6 +22,15 @@
 # Default is production
 CONFIG = config.ProductionConfig()
 
+log = logging.getLogger('riboplot')
+
+
+class ErrorLogFormatter(logging.Formatter):
+    """Custom error log format for the HTML file"""
+
+    def format(self, record):
+        return '<h2>RiboCount Error</h2><p>{}</p>'.format(record.msg)
+
 
 def create_parser():
     """Argument parser. """
@@ -38,38 +47,35 @@
                         metavar='INTEGER', type=int)
     parser.add_argument('-s', '--read_offset', help='Read offset (default: %(default)s)',
                         metavar='INTEGER', type=int, default=0)
-    parser.add_argument('-m', '--html_file', help='Output file for results (HTML)', default='output/index.html')
+    parser.add_argument('-m', '--html_file', help='Output file for results (HTML)', default='ribocount.html')
     parser.add_argument('-o', '--output_path', help='Files are saved in this directory', default='output')
     parser.add_argument('-d', '--debug', help='Flag. Produce debug output', action='store_true')
 
     return parser
 
 
-if __name__ == '__main__':
-    parsed = create_parser()
-    args = parsed.parse_args()
+def main(args):
+    """Main program"""
+    (ribo_file, transcriptome_fasta, read_length, read_offset, output_path, html_file) = (
+        args.ribo_file, args.transcriptome_fasta, args.read_length,
+        args.read_offset, args.output_path, args.html_file)
 
-    if args.debug:
-        level = logging.DEBUG
-    else:
-        level = logging.INFO
-
-    logging.basicConfig(format='%(levelname)s: %(message)s',
-                        level=level, stream=sys.stdout, datefmt='%d/%m/%Y %I:%M:%S %p')
+    log.debug('Supplied arguments\n{}'.format(
+        '\n'.join(['{:<20}: {}'.format(k, v) for k, v in vars(args).items()])))
 
-    start = datetime.now()
-    logging.debug('Supplied arguments\n{}'.format('\n'.join(['{:<20}: {}'.format(k, v) for k, v in vars(args).items()])))
-
-    (ribo_file, transcriptome_fasta, read_length, read_offset, output_path) = (
-        args.ribo_file, args.transcriptome_fasta, args.read_length, args.read_offset, args.output_path)
+    # error messages (simple format) are written to html file
+    fh = logging.FileHandler(html_file)
+    fh.setLevel(logging.ERROR)
+    fh.setFormatter(ErrorLogFormatter('%(message)s'))
+    log.addHandler(fh)
 
-    logging.info('Checking if required arguments are valid...')
+    log.info('Checking if required arguments are valid...')
     ribocore.check_required_arguments(ribo_file=ribo_file, transcriptome_fasta=transcriptome_fasta)
-    logging.info('Done')
+    log.info('Done')
 
-    logging.info('Checking if optional arguments are valid...')
+    log.info('Checking if optional arguments are valid...')
     ribocore.check_optional_arguments(ribo_file=ribo_file, read_length=read_length, read_offset=read_offset)
-    logging.info('Done')
+    log.info('Done')
 
     if not os.path.exists(output_path):
         os.mkdir(output_path)
@@ -84,17 +90,17 @@
     if not os.path.exists(csv_dir):
         os.mkdir(csv_dir)
 
-    logging.info('Get RiboSeq read counts for all transcripts in FASTA')
     count = 0
     table_content = ''
     bam_fileobj = pysam.AlignmentFile(ribo_file, 'rb')
     fasta_file = pysam.FastaFile(transcriptome_fasta)
+    log.info('Get RiboSeq read counts for all transcripts in FASTA')
     for transcript in fasta_file.references:
         rp_counts, rp_reads = ribocore.get_ribo_counts(bam_fileobj, transcript, read_length)
         if not rp_reads:  # no reads for this transcript. skip.
             continue
 
-        logging.debug('Writing counts for {}'.format(transcript))
+        log.debug('Writing counts for {}'.format(transcript))
         count += 1
         csv_file = 'RiboCounts{}.csv'.format(count)
         with open(os.path.join(csv_dir, csv_file), 'w') as f:
@@ -106,12 +112,8 @@
                         pos, rp_counts[pos][1], rp_counts[pos][2], rp_counts[pos][3]))
                 else:
                     f.write('{0},{1},{2},{3}\n'.format(pos, 0, 0, 0))
-        if count % 2 == 0:
-            table_content += '<tr>'
-        else:
-            table_content += '<tr class="odd">'
-        table_content += '<td>{0}</td><td>{1}</td><td>{2}</td><td><a href="csv/{3}">{3}</a></td></tr>'.format(
-            count, transcript, rp_reads, csv_file)
+        table_content += ('<tr><td>{0}</td><td>{1}</td><td>{2}</td><td><a href="csv/{3}">'
+                          '{3}</a></td></tr>'.format(count, transcript, rp_reads, csv_file))
     fasta_file.close()
     bam_fileobj.close()
 
@@ -119,21 +121,17 @@
     if not read_length:
         read_length = 'All'
 
-    duration = str(datetime.now() - start).split('.')[0]
-    logging.info('Done')
+    log.info('Done')
 
     if not count:
         if read_length:
-            logging.info('No transcripts found for read length {}'.format(read_length))
+            log.info('No transcripts found for read length {}'.format(read_length))
         else:
-            logging.info('No transcripts found')
+            log.info('No transcripts found')
     else:
-        logging.info('Time taken for generating counts for {0} transcripts: {1}, footprint '
-                     'length: {2}'.format(count, duration, read_length))
-
         with open(os.path.join(CONFIG.DATA_DIR, 'ribocount.html')) as g,\
                 open(os.path.join(zip_dir, 'index.html'), 'w') as h:
-            h.write(g.read().format(count=count, length=read_length, table_content=table_content, duration=duration))
+            h.write(g.read().format(count=count, length=read_length, table_content=table_content))
 
         for asset in ('css', 'js'):
             asset_dir = os.path.join(zip_dir, asset)
@@ -144,7 +142,7 @@
                 shutil.copy(os.path.join(asset_data_dir, fname),
                             os.path.join(zip_dir, asset, fname))
 
-        logging.info('Creating zip file')
+        log.info('Creating zip file')
         os.chdir(output_path)
         with zipfile.ZipFile('ribocount_output.zip', 'w') as zipf:
             for root, d, f in os.walk('ribocount_output'):
@@ -152,8 +150,13 @@
                     zipf.write(os.path.join(root, name))
         shutil.rmtree('ribocount_output')
         os.chdir('../')
-        logging.debug('Writing HTML report')
+        log.debug('Writing HTML report')
 
         with open(os.path.join(CONFIG.DATA_DIR, 'ribocount_index.html')) as j, open(args.html_file, 'w') as k:
             k.write(j.read().format(count=count, read_length=read_length))
-    logging.info('Finished')
+    log.info('Finished')
+
+if __name__ == '__main__':
+    parsed = create_parser()
+    args = parsed.parse_args()
+    main(args)
b
diff -r 8964641b04ef -r 7571f5c89090 riboplot/riboplot.py
--- a/riboplot/riboplot.py Mon Aug 17 10:51:58 2015 +0100
+++ b/riboplot/riboplot.py Wed Aug 19 10:14:52 2015 +0100
[
@@ -36,6 +36,16 @@
 # Default is production
 CONFIG = config.ProductionConfig()
 
+# create logger
+log = logging.getLogger('riboplot')
+
+
+class ErrorLogFormatter(logging.Formatter):
+    """Custom error log format for the HTML file"""
+
+    def format(self, record):
+        return '<h2>RiboPlot Error</h2><p>{}</p>'.format(record.msg)
+
 
 def get_start_stops(transcript_sequence, start_codons=None, stop_codons=None):
         """Return start and stop positions for all frames in the given
@@ -245,7 +255,7 @@
                         metavar='INTEGER', type=int)
     parser.add_argument('-s', '--read_offset', help='Read offset (default: %(default)s)',
                         metavar='INTEGER', type=int, default=0)
-    parser.add_argument('-m', '--html_file', help='Output file for results (HTML)', default='index.html')
+    parser.add_argument('-m', '--html_file', help='Output file for results (HTML)', default='riboplot.html')
     parser.add_argument('-o', '--output_path', help='Files are saved in this directory', default='output')
     parser.add_argument('-d', '--debug', help='Flag. Produce debug output', action='store_true')
 
@@ -253,31 +263,32 @@
 
 
 def main(args):
-    """Start program"""
-    if args.debug:
-        level = logging.DEBUG
-    else:
-        level = logging.INFO
+    """Main program"""
+    (ribo_file, rna_file, transcript_name, transcriptome_fasta, read_length,
+     read_offset, output_path, html_file) = (
+         args.ribo_file, args.rna_file, args.transcript_name, args.transcriptome_fasta,
+         args.read_length, args.read_offset, args.output_path, args.html_file)
 
-    logging.basicConfig(format='%(levelname)s: %(message)s',
-                        level=level, stream=sys.stdout, datefmt='%d/%m/%Y %I:%M:%S %p')
-    logging.debug('Supplied arguments\n{}'.format(
+    log.debug('Supplied arguments\n{}'.format(
         '\n'.join(['{:<20}: {}'.format(k, v) for k, v in vars(args).items()])))
 
-    (ribo_file, rna_file, transcript_name, transcriptome_fasta, read_length,
-     read_offset, output_path) = (args.ribo_file, args.rna_file,
-                                  args.transcript_name, args.transcriptome_fasta,
-                                  args.read_length, args.read_offset, args.output_path)
+    # error messages (simple format) are written to html file
+    fh = logging.FileHandler(args.html_file)
+    fh.setLevel(logging.ERROR)
+    fh.setFormatter(ErrorLogFormatter('%(message)s'))
+    log.addHandler(fh)
 
-    logging.info('Checking if required arguments are valid...')
+    log.info('Checking if required arguments are valid...')
     ribocore.check_required_arguments(ribo_file=ribo_file, transcriptome_fasta=transcriptome_fasta,
                                       transcript_name=transcript_name)
+    log.info('Done')
 
-    logging.info('Checking if optional arguments are valid...')
+    log.info('Checking if optional arguments are valid...')
     ribocore.check_optional_arguments(ribo_file=ribo_file, read_length=read_length, read_offset=read_offset,
                                       rna_file=rna_file)
+    log.info('Done')
 
-    logging.info('Get ribo-seq read counts and total reads in Ribo-Seq...')
+    log.info('Get ribo-seq read counts and total reads in Ribo-Seq...')
     bam_fileobj = pysam.AlignmentFile(ribo_file, 'rb')
     ribo_counts, total_reads = ribocore.get_ribo_counts(bam_fileobj, transcript_name, read_length)
     bam_fileobj.close()
@@ -285,37 +296,36 @@
     if not ribo_counts:
         msg = ('No RiboSeq read counts for transcript {}. No plot will be '
                'generated!'.format(transcript_name))
-        logging.error(msg)
+        log.error(msg)
         raise ribocore.RiboPlotError(msg)
     else:
-        logging.info('Get RNA counts for the given transcript...')
+        log.info('Get RNA counts for the given transcript...')
         mrna_counts = {}
         if rna_file:
             try:
                 mrna_counts = get_rna_counts(rna_file, transcript_name)
             except OSError as e:
-                logging.error(e)
+                log.error(e)
                 raise
 
             if not mrna_counts:
-                logging.warn('No RNA counts for this transcript from the given RNA Seq file. '
-                             'RNA-Seq coverage will not be generated')
-
+                log.warn('No RNA counts for this transcript from the given RNA Seq file. '
+                         'RNA-Seq coverage will not be generated')
         else:
-            logging.debug('No RNA-Seq data provided. Not generating coverage')
+            log.debug('No RNA-Seq data provided. Not generating coverage')
 
-        logging.info('Get sequence and length of the given transcripts from FASTA file...')
+        log.info('Get sequence and length of the given transcripts from FASTA file...')
         fasta_records = ribocore.get_fasta_records(transcriptome_fasta, [transcript_name])
         transcript_seq, transcript_length = (fasta_records[transcript_name]['sequence'],
                                              fasta_records[transcript_name]['length'])
 
-        logging.info('Get start/stop positions in transcript sequence (3 frames)...')
+        log.info('Get start/stop positions in transcript sequence (3 frames)...')
         codon_positions = get_start_stops(transcript_seq)
 
         if not os.path.exists(output_path):
             os.mkdir(output_path)
 
-        logging.info('Writing RiboSeq read counts for {}'.format(transcript_name))
+        log.info('Writing RiboSeq read counts for {}'.format(transcript_name))
         with open(os.path.join(output_path, 'RiboCounts.csv'), 'w') as f:
             f.write('"Position","Frame 1","Frame 2","Frame 3"\n')
 
@@ -326,11 +336,11 @@
                 else:
                     f.write('{0},{1},{2},{3}\n'.format(pos, 0, 0, 0))
 
-        logging.info('Generating RiboPlot...')
+        log.info('Generating RiboPlot...')
         plot_profile(ribo_counts, transcript_name, transcript_length,
                      codon_positions, read_length, read_offset, mrna_counts,
                      html_file=args.html_file, output_path=args.output_path)
-    logging.info('Finished!')
+    log.info('Finished!')
 
 if __name__ == '__main__':
     parsed = create_parser()
b
diff -r 8964641b04ef -r 7571f5c89090 run_coverage.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/run_coverage.sh Wed Aug 19 10:14:52 2015 +0100
b
@@ -0,0 +1,2 @@
+coverage run --source tests/test_riboplot.py --source riboplot setup.py test
+coverage html