changeset 7:096c6bbf4a04

Bugfix: (ribocounts) Read length was sent as rnafile argument in check_optional_arguments
author Vimalkumar Velayudhan <vimal@biotechcoder.com>
date Thu, 13 Aug 2015 15:03:20 +0100
parents 2ffa8172dce1
children 844eb8c36f32
files AUTHORS.rst CONTRIBUTING.rst HISTORY.rst Makefile README.rst docs/authors.rst docs/conf.py docs/contributing.rst docs/history.rst docs/index.rst docs/readme.rst docs/usage.rst riboplot.egg-info/PKG-INFO riboplot.egg-info/SOURCES.txt riboplot/ribocore.py riboplot/ribocount.py riboplot/riboplot.py run_ribocount_sample.sh runtests.sh tests/test_riboplot.py
diffstat 20 files changed, 225 insertions(+), 185 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/AUTHORS.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,13 +1,1 @@
-=======
-Credits
-=======
-
-Development Lead
-----------------
-
-* Vimalkumar Velayudhan <vimalkumarvelayudhan@gmail.com>
-
-Contributors
-------------
-
-None yet. Why not be the first?
\ No newline at end of file
+docs/authors.rst
\ No newline at end of file
--- a/CONTRIBUTING.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/CONTRIBUTING.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,111 +1,1 @@
-============
-Contributing
-============
-
-Contributions are welcome, and they are greatly appreciated! Every
-little bit helps, and credit will always be given.
-
-You can contribute in many ways:
-
-Types of Contributions
-----------------------
-
-Report Bugs
-~~~~~~~~~~~
-
-Report bugs at https://github.com/vimalkumarvelayudhan/riboplot/issues.
-
-If you are reporting a bug, please include:
-
-* Your operating system name and version.
-* Any details about your local setup that might be helpful in troubleshooting.
-* Detailed steps to reproduce the bug.
-
-Fix Bugs
-~~~~~~~~
-
-Look through the GitHub issues for bugs. Anything tagged with "bug"
-is open to whoever wants to implement it.
-
-Implement Features
-~~~~~~~~~~~~~~~~~~
-
-Look through the GitHub issues for features. Anything tagged with "feature"
-is open to whoever wants to implement it.
-
-Write Documentation
-~~~~~~~~~~~~~~~~~~~
-
-RiboPlot could always use more documentation, whether as part of the
-official RiboPlot docs, in docstrings, or even on the web in blog posts,
-articles, and such.
-
-Submit Feedback
-~~~~~~~~~~~~~~~
-
-The best way to send feedback is to file an issue at https://github.com/vimalkumarvelayudhan/riboplot/issues.
-
-If you are proposing a feature:
-
-* Explain in detail how it would work.
-* Keep the scope as narrow as possible, to make it easier to implement.
-* Remember that this is a volunteer-driven project, and that contributions
-  are welcome :)
-
-Get Started!
-------------
-
-Ready to contribute? Here's how to set up `riboplot` for local development.
-
-1. Fork the `riboplot` repo on GitHub.
-2. Clone your fork locally::
-
-    $ git clone git@github.com:your_name_here/riboplot.git
-
-3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
-
-    $ mkvirtualenv riboplot
-    $ cd riboplot/
-    $ python setup.py develop
-
-4. Create a branch for local development::
-
-    $ git checkout -b name-of-your-bugfix-or-feature
-
-   Now you can make your changes locally.
-
-5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
-
-    $ flake8 riboplot tests
-    $ python setup.py test
-    $ tox
-
-   To get flake8 and tox, just pip install them into your virtualenv.
-
-6. Commit your changes and push your branch to GitHub::
-
-    $ git add .
-    $ git commit -m "Your detailed description of your changes."
-    $ git push origin name-of-your-bugfix-or-feature
-
-7. Submit a pull request through the GitHub website.
-
-Pull Request Guidelines
------------------------
-
-Before you submit a pull request, check that it meets these guidelines:
-
-1. The pull request should include tests.
-2. If the pull request adds functionality, the docs should be updated. Put
-   your new functionality into a function with a docstring, and add the
-   feature to the list in README.rst.
-3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check
-   https://travis-ci.org/vimalkumarvelayudhan/riboplot/pull_requests
-   and make sure that the tests pass for all supported Python versions.
-
-Tips
-----
-
-To run a subset of tests::
-
-    $ python -m unittest tests.test_riboplot
\ No newline at end of file
+docs/contributing.rst
\ No newline at end of file
--- a/HISTORY.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/HISTORY.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,9 +1,1 @@
-.. :changelog:
-
-History
--------
-
-0.1.0 (2015-08-05)
----------------------
-
-* First release on PyPI.
\ No newline at end of file
+docs/history.rst
\ No newline at end of file
--- a/Makefile	Wed Aug 12 16:28:43 2015 +0100
+++ b/Makefile	Thu Aug 13 15:03:20 2015 +0100
@@ -55,7 +55,6 @@
 	sphinx-apidoc -o docs/ riboplot
 	$(MAKE) -C docs clean
 	$(MAKE) -C docs html
-	open docs/_build/html/index.html
 
 release: clean
 	python setup.py sdist upload
@@ -67,4 +66,4 @@
 	ls -l dist
 
 install: clean
-	python setup.py install
\ No newline at end of file
+	python setup.py install
--- a/README.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/README.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,20 +1,1 @@
-===============================
-RiboPlot
-===============================
-
-.. image:: https://img.shields.io/travis/vimalkumarvelayudhan/riboplot.svg
-        :target: https://travis-ci.org/vimalkumarvelayudhan/riboplot
-
-.. image:: https://img.shields.io/pypi/v/riboplot.svg
-        :target: https://pypi.python.org/pypi/riboplot
-
-
-Plot read counts of RiboSeq data from BAM format alignment files
-
-* Free software: BSD license
-* Documentation: https://riboplot.readthedocs.org.
-
-Features
---------
-
-* TODO
\ No newline at end of file
+docs/readme.rst
\ No newline at end of file
--- a/docs/authors.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/authors.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,1 +1,13 @@
-../AUTHORS.rst
\ No newline at end of file
+=======
+Credits
+=======
+
+Development Lead
+----------------
+
+* Vimalkumar Velayudhan <vimalkumarvelayudhan@gmail.com>
+
+Contributors
+------------
+
+None yet. Why not be the first?
\ No newline at end of file
--- a/docs/conf.py	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/conf.py	Thu Aug 13 15:03:20 2015 +0100
@@ -111,12 +111,20 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a
 # theme further.  For a list of options available for each theme, see the
 # documentation.
 #html_theme_options = {}
+html_theme_options = {
+        'font_family': '"Open Sans", Ubuntu, sans-serif',
+        'head_font_family': '"Open Sans", Ubuntu, sans-serif',
+        'code_font_family': '"Source Code Pro", "Ubuntu Mono", monospace',
+        'code_font_size': '0.8em',
+        'pre_bg': '#f9f9f9', 'note_bg': '#e6f7ff', 'note_border': '#ccefff',
+        'sidebar_list': '#777777', 'body_text': '#515151', 'show_powered_by': False}
+
 
 # Add any paths that contain custom themes here, relative to this directory.
 #html_theme_path = []
@@ -272,4 +280,4 @@
 #texinfo_show_urls = 'footnote'
 
 # If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
\ No newline at end of file
+#texinfo_no_detailmenu = False
--- a/docs/contributing.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/contributing.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,1 +1,111 @@
-../CONTRIBUTING.rst
\ No newline at end of file
+============
+Contributing
+============
+
+Contributions are welcome, and they are greatly appreciated! Every
+little bit helps, and credit will always be given.
+
+You can contribute in many ways:
+
+Types of Contributions
+----------------------
+
+Report Bugs
+~~~~~~~~~~~
+
+Report bugs at https://github.com/vimalkumarvelayudhan/riboplot/issues.
+
+If you are reporting a bug, please include:
+
+* Your operating system name and version.
+* Any details about your local setup that might be helpful in troubleshooting.
+* Detailed steps to reproduce the bug.
+
+Fix Bugs
+~~~~~~~~
+
+Look through the GitHub issues for bugs. Anything tagged with "bug"
+is open to whoever wants to implement it.
+
+Implement Features
+~~~~~~~~~~~~~~~~~~
+
+Look through the GitHub issues for features. Anything tagged with "feature"
+is open to whoever wants to implement it.
+
+Write Documentation
+~~~~~~~~~~~~~~~~~~~
+
+RiboPlot could always use more documentation, whether as part of the
+official RiboPlot docs, in docstrings, or even on the web in blog posts,
+articles, and such.
+
+Submit Feedback
+~~~~~~~~~~~~~~~
+
+The best way to send feedback is to file an issue at https://github.com/vimalkumarvelayudhan/riboplot/issues.
+
+If you are proposing a feature:
+
+* Explain in detail how it would work.
+* Keep the scope as narrow as possible, to make it easier to implement.
+* Remember that this is a volunteer-driven project, and that contributions
+  are welcome :)
+
+Get Started!
+------------
+
+Ready to contribute? Here's how to set up `riboplot` for local development.
+
+1. Fork the `riboplot` repo on GitHub.
+2. Clone your fork locally::
+
+    $ git clone git@github.com:your_name_here/riboplot.git
+
+3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
+
+    $ mkvirtualenv riboplot
+    $ cd riboplot/
+    $ python setup.py develop
+
+4. Create a branch for local development::
+
+    $ git checkout -b name-of-your-bugfix-or-feature
+
+   Now you can make your changes locally.
+
+5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
+
+    $ flake8 riboplot tests
+    $ python setup.py test
+    $ tox
+
+   To get flake8 and tox, just pip install them into your virtualenv.
+
+6. Commit your changes and push your branch to GitHub::
+
+    $ git add .
+    $ git commit -m "Your detailed description of your changes."
+    $ git push origin name-of-your-bugfix-or-feature
+
+7. Submit a pull request through the GitHub website.
+
+Pull Request Guidelines
+-----------------------
+
+Before you submit a pull request, check that it meets these guidelines:
+
+1. The pull request should include tests.
+2. If the pull request adds functionality, the docs should be updated. Put
+   your new functionality into a function with a docstring, and add the
+   feature to the list in README.rst.
+3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. Check
+   https://travis-ci.org/vimalkumarvelayudhan/riboplot/pull_requests
+   and make sure that the tests pass for all supported Python versions.
+
+Tips
+----
+
+To run a subset of tests::
+
+    $ python -m unittest tests.test_riboplot
\ No newline at end of file
--- a/docs/history.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/history.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,1 +1,9 @@
-../HISTORY.rst
\ No newline at end of file
+.. :changelog:
+
+History
+=======
+
+0.1.0 (2015-08-05)
+---------------------
+
+* First release on PyPI.
--- a/docs/index.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/index.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -3,8 +3,8 @@
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-Welcome to RiboPlot's documentation!
-======================================
+RiboPlot documentation
+======================
 
 Contents:
 
--- a/docs/readme.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/readme.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -1,1 +1,28 @@
-../README.rst
\ No newline at end of file
+===============================
+RiboPlot
+===============================
+
+.. image:: https://img.shields.io/travis/vimalkumarvelayudhan/riboplot.svg
+        :target: https://travis-ci.org/vimalkumarvelayudhan/riboplot
+
+.. image:: https://img.shields.io/pypi/v/riboplot.svg
+        :target: https://pypi.python.org/pypi/riboplot
+
+
+RiboPlot includes programs to plot and output Ribo-Seq read counts from an alignment file (BAM format).
+
+There are two programs in the package:
+
+**riboplot**
+    Plot and output read counts (csv) for a single transcript.
+
+**ribocount**
+    Output read counts for all transcripts in an alignment.
+
+For help on using these programs, please refer to :doc:`usage`.
+
+
+Free software: BSD license.
+
+Documentation: https://riboplot.readthedocs.org.
+
--- a/docs/usage.rst	Wed Aug 12 16:28:43 2015 +0100
+++ b/docs/usage.rst	Thu Aug 13 15:03:20 2015 +0100
@@ -2,6 +2,15 @@
 Usage
 ========
 
-To use RiboPlot in a project::
+RiboPlot
+--------
+Plot and output Ribo-Seq read counts of a single transcript from an alignment file (sorted BAM).
 
-    import riboplot
\ No newline at end of file
+Parameters
+..........
+1. Ribo-Seq alignment file (sorted BAM)
+   A bowtie 1 
+
+RiboCount
+---------
+
--- a/riboplot.egg-info/PKG-INFO	Wed Aug 12 16:28:43 2015 +0100
+++ b/riboplot.egg-info/PKG-INFO	Thu Aug 13 15:03:20 2015 +0100
@@ -17,25 +17,35 @@
                 :target: https://pypi.python.org/pypi/riboplot
         
         
-        Plot read counts of RiboSeq data from BAM format alignment files
+        RiboPlot includes programs to plot and output Ribo-Seq read counts from an alignment file (BAM format).
         
-        * Free software: BSD license
-        * Documentation: https://riboplot.readthedocs.org.
+        There are two programs in the package:
+        
+        **riboplot**
+            Plot and output read counts (csv) for a single transcript.
         
-        Features
-        --------
+        **ribocount**
+            Output read counts for all transcripts in an alignment.
+        
+        For help on using these programs, please refer to :doc:`usage`.
+        
         
-        * TODO
+        Free software: BSD license.
+        
+        Documentation: https://riboplot.readthedocs.org.
+        
+        
         
         
         
         History
-        -------
+        =======
         
         0.1.0 (2015-08-05)
         ---------------------
         
         * First release on PyPI.
+        
 Keywords: riboplot
 Platform: UNKNOWN
 Classifier: Development Status :: 2 - Pre-Alpha
--- a/riboplot.egg-info/SOURCES.txt	Wed Aug 12 16:28:43 2015 +0100
+++ b/riboplot.egg-info/SOURCES.txt	Thu Aug 13 15:03:20 2015 +0100
@@ -14,7 +14,9 @@
 docs/index.rst
 docs/installation.rst
 docs/make.bat
+docs/modules.rst
 docs/readme.rst
+docs/riboplot.rst
 docs/todo.rst
 docs/usage.rst
 riboplot/__init__.py
@@ -22,12 +24,12 @@
 riboplot/ribocore.py
 riboplot/ribocount.py
 riboplot/riboplot.py
+riboplot/riboplot_multi.py
 riboplot.egg-info/PKG-INFO
 riboplot.egg-info/SOURCES.txt
 riboplot.egg-info/dependency_links.txt
 riboplot.egg-info/not-zip-safe
 riboplot.egg-info/top_level.txt
-tests/.test_riboplot.py.swp
 tests/__init__.py
 tests/test_riboplot.py
 tests/data/5hRPF.bam
--- a/riboplot/ribocore.py	Wed Aug 12 16:28:43 2015 +0100
+++ b/riboplot/ribocore.py	Thu Aug 13 15:03:20 2015 +0100
@@ -162,7 +162,7 @@
             if transcript_name not in bam_file.references:
                 raise ArgumentError('Transcript "{}" does not exist in BAM file'.format(transcript_name))
 
-def check_optional_arguments(ribo_file, rna_file=None, read_length=None, read_offset=None):
+def check_optional_arguments(ribo_file, read_length=None, read_offset=None, rna_file=None):
     """Check all optional arguments."""
     if rna_file:
         try:
--- a/riboplot/ribocount.py	Wed Aug 12 16:28:43 2015 +0100
+++ b/riboplot/ribocount.py	Thu Aug 13 15:03:20 2015 +0100
@@ -64,11 +64,11 @@
         args.ribo_file, args.transcriptome_fasta, args.read_length, args.read_offset, args.output_path)
 
     logging.info('Checking if required arguments are valid...')
-    ribocore.check_required_arguments(ribo_file, transcriptome_fasta)
+    ribocore.check_required_arguments(ribo_file=ribo_file, transcriptome_fasta=transcriptome_fasta)
     logging.info('Done')
 
     logging.info('Checking if optional arguments are valid...')
-    ribocore.check_optional_arguments(ribo_file, read_length, read_offset)
+    ribocore.check_optional_arguments(ribo_file=ribo_file, read_length=read_length, read_offset=read_offset)
     logging.info('Done')
 
     if not os.path.exists(output_path):
--- a/riboplot/riboplot.py	Wed Aug 12 16:28:43 2015 +0100
+++ b/riboplot/riboplot.py	Thu Aug 13 15:03:20 2015 +0100
@@ -270,10 +270,12 @@
                                   args.read_length, args.read_offset, args.output_path)
 
     logging.info('Checking if required arguments are valid...')
-    ribocore.check_required_arguments(ribo_file, transcriptome_fasta, transcript_name)
+    ribocore.check_required_arguments(ribo_file=ribo_file, transcriptome_fasta=transcriptome_fasta,
+                                      transcript_name=transcript_name)
 
     logging.info('Checking if optional arguments are valid...')
-    ribocore.check_optional_arguments(ribo_file, rna_file, read_length, read_offset)
+    ribocore.check_optional_arguments(ribo_file=ribo_file, read_length=read_length, read_offset=read_offset,
+                                      rna_file=rna_file)
 
     logging.info('Get ribo-seq read counts and total reads in Ribo-Seq...')
     bam_fileobj = pysam.AlignmentFile(ribo_file, 'rb')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run_ribocount_sample.sh	Thu Aug 13 15:03:20 2015 +0100
@@ -0,0 +1,4 @@
+#!/bin/bash
+python riboplot/ribocount.py -b tests/data/5hRPFsorted.bam \
+    -f tests/data/zebrafish.fna 
+
--- a/runtests.sh	Wed Aug 12 16:28:43 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#!/bin/bash
-python -m unittest discover --verbose
--- a/tests/test_riboplot.py	Wed Aug 12 16:28:43 2015 +0100
+++ b/tests/test_riboplot.py	Thu Aug 13 15:03:20 2015 +0100
@@ -27,7 +27,7 @@
             ['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME, '-n', RNA_FILE])
         save_path = os.environ['PATH']
         os.environ['PATH'] = ''
-        self.assertRaises(OSError, ribocore.check_optional_arguments, args.ribo_file, args.rna_file)
+        self.assertRaises(OSError, ribocore.check_optional_arguments, ribo_file=args.ribo_file, rna_file=args.rna_file)
         os.environ['PATH'] = save_path
 
     def test_is_bam_valid(self):
@@ -70,19 +70,19 @@
         args = self.parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME,
                                        '-l', '-1'])  # invalid read length -1
         self.assertRaises(ribocore.ArgumentError, ribocore.check_optional_arguments,
-                          args.ribo_file, None, args.read_length)
+                          ribo_file=args.ribo_file, read_length=args.read_length)
 
         args = self.parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME,
                                        '-l', '100'])  # invalid read length 100
         self.assertRaises(ribocore.ArgumentError, ribocore.check_optional_arguments,
-                          args.ribo_file, None, args.read_length)
+                          ribo_file=args.ribo_file, read_length=args.read_length)
 
     def test_valid_read_offset(self):
         """Read offset should be positive."""
         args = self.parser.parse_args(['-b', RIBO_FILE, '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME,
                                        '-s', '-1'])  # invalid read offset -1
         self.assertRaises(ribocore.ArgumentError, ribocore.check_optional_arguments,
-                          args.ribo_file, None, None, args.read_offset)
+                          ribo_file=args.ribo_file, read_offset=args.read_offset)
 
     def test_is_fasta_valid(self):
         """A valid FASTA file can be opened with pysam.FastaFile."""
@@ -116,7 +116,7 @@
         # using transcriptome FASTA file as the invalid RNA file for test
         parser = riboplot.create_parser()
         args = parser.parse_args(['-b', RIBO_FILE,  '-f', TRANSCRIPTOME_FASTA, '-t', TRANSCRIPT_NAME, '-n', TRANSCRIPTOME_FASTA])
-        self.assertRaises(ValueError, ribocore.check_optional_arguments, args.ribo_file, args.rna_file)
+        self.assertRaises(ValueError, ribocore.check_optional_arguments, ribo_file=args.ribo_file, rna_file=args.rna_file)
 
 class RiboPlotTestCase(unittest.TestCase):