changeset 2:b6fd86c539ea

Fix pysam version in riboplot (was 0.7.7 instead of 0.8.3). Fix move sys import to the top in ribocount.py, riboplot.py. Minor: * Include an empty conditional when no RNA coverage is required. * Remove output directories after zip file is created.
author Vimalkumar Velayudhan <vimal@biotechcoder.com>
date Thu, 02 Jul 2015 11:53:59 +0100
parents 1e9797878349
children 8e1efafa6277
files data/riboplot.html ribocount.xml riboplot.xml riboplot/ribocount.py riboplot/riboplot.py
diffstat 5 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/data/riboplot.html	Mon Jun 29 17:12:15 2015 +0100
+++ b/data/riboplot.html	Thu Jul 02 11:53:59 2015 +0100
@@ -41,13 +41,13 @@
                 <p>
                 <img width="100%" class="u-max-full-width" src="ribograph.png"/><br>
                 <p>
-                <h4>Download plots<br>
+                <h5>Download plots<br>
                     <a href="ribograph.png">PNG</a>, <a href="ribograph.svg">SVG</a>
-                </h4>
+                </h5>
 
-                <h4>Download counts<br>
+                <h5>Download counts<br>
                  <a href="RiboCounts.csv">RiboCounts.csv</a>
-                </h4>
+                </h5>
                 <p>
                     <small>
                         (Right click --> Save link/target as...)
--- a/ribocount.xml	Mon Jun 29 17:12:15 2015 +0100
+++ b/ribocount.xml	Thu Jul 02 11:53:59 2015 +0100
@@ -7,7 +7,7 @@
     <stdio>
         <exit_code range="1:"  level="fatal" description="Error" />
     </stdio>
-    <command interpreter="python">./riboplot/ribocount.py
+    <command interpreter="python">riboplot/ribocount.py
     --ribo_file "${ribo_file}"
     --transcriptome_fasta "${transcriptome_fasta}"
     --read_length "${read_length}"
--- a/riboplot.xml	Mon Jun 29 17:12:15 2015 +0100
+++ b/riboplot.xml	Thu Jul 02 11:53:59 2015 +0100
@@ -3,12 +3,12 @@
     </description>
     <requirements>
         <requirement type="package" version="1.2.1">matplotlib</requirement>
-        <requirement type="package" version="0.7.7">pysam</requirement>
+        <requirement type="package" version="0.8.3">pysam</requirement>
     </requirements>
     <stdio>
         <exit_code range="1:"  level="fatal" description="Error" />
     </stdio>
-    <command interpreter="python">./riboplot/riboplot.py
+    <command interpreter="python">riboplot/riboplot.py
     --ribo_file "${ribo_file}"
     --transcriptome_fasta "${transcriptome_fasta}"
     --transcript_name "${transcript_name}"
@@ -41,6 +41,7 @@
             <when value="yes">
                 <param name="rna_file" type="data" format="bam" label="RNA-Seq alignment file in BAM format"/>
             </when>
+            <when value="no" />
         </conditional>
         <param name="read_length" type="integer" label="Read length to consider" value="28"/>
         <param name="read_offset" type="integer" label="Offset" value="0"/>
--- a/riboplot/ribocount.py	Mon Jun 29 17:12:15 2015 +0100
+++ b/riboplot/ribocount.py	Thu Jul 02 11:53:59 2015 +0100
@@ -1,4 +1,6 @@
 # check dependencies
+import sys
+
 missing_deps = []
 try:
     import pysam
@@ -11,8 +13,7 @@
     \n\n{}\n'''.format('\n'.join(missing_deps)))
 
 import os
-import sys
-import timeit
+# import timeit
 import shutil
 import zipfile
 import logging
@@ -141,10 +142,12 @@
             for name in f:
                 zip.write(os.path.join(root, name))
 
+    shutil.rmtree(output_path)
     logging.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))
 
 if __name__ == '__main__':
-    print timeit.timeit('main()', number=1, setup='from __main__ import main')
+    # print timeit.timeit('main()', number=1, setup='from __main__ import main')
+    main()
--- a/riboplot/riboplot.py	Mon Jun 29 17:12:15 2015 +0100
+++ b/riboplot/riboplot.py	Thu Jul 02 11:53:59 2015 +0100
@@ -1,4 +1,6 @@
 # check dependencies
+import sys
+
 missing_deps = []
 try:
     import pysam
@@ -21,10 +23,9 @@
 
 import os
 import re
-import sys
 import config
 import pysam
-import timeit
+# import timeit
 import shutil
 import logging
 import tempfile
@@ -316,4 +317,5 @@
 
 
 if __name__ == '__main__':
-    print timeit.timeit('main()', number=1, setup='from __main__ import main')
+    # print timeit.timeit('main()', number=1, setup='from __main__ import main')
+    main()