Command Line Scripts¶
We would like to add a command line tool that allows users to run PlotMAPQ from the command line. As mentioned in Project Setup, we have included a bin directory that contains scripts that can be run from the command line. This allows users to call our modules from a script, as well as python. To do so, all we have to do is add a script that calls PlotMAPQ, and then declare the script in our setup script.
- First, make a file called
bin/plot-mapq. This file will call PlotMAPQ.
- Next, modify the setup.py file to include your new script in the package:
setup( ... scripts = ['/bin/plot-mapq'] ... )
For more information on command line tools, see the python packaging documentation.
Now, we can run PlotMAPQ from the command line:
>> plot-mapq usage: plot-mapq [options] alignment_bam sample_name out_directory plot-mapq: error: the following arguments are required: bamIn, sampleName, dirOut
We can also just print the version:
>> plot-mapq -v 0.0.1a0