Mercurial > repos > sanbi-uwc > novo_sort
view novo_sort.py @ 5:6e11ef75c56c draft
planemo upload for repository https://github.com/zipho/novo_sort commit 91b08bec675d4e76b371b0f01bc0729cd6fbacdc
author | sanbi-uwc |
---|---|
date | Fri, 01 Apr 2016 10:16:18 -0400 |
parents | 146641fe5ff6 |
children | e35fbd921b6b |
line wrap: on
line source
#!/usr/bin/env python from __future__ import print_function import argparse from subprocess import check_call, CalledProcessError import shlex import sys import logging log = logging.getLogger( __name__ ) def novo_sort( bam_filename, output_filename ): cmdline_str = "novosort -c 8 -m 8G -s -f {} > {}".format( bam_filename, output_filename ) cmdline = newSplit(cmdline_str) try: check_call(cmdline) except CalledProcessError: print("Error running the nova-sort", file=sys.stderr) def newSplit(value): lex = shlex.shlex(value) lex.quotes = '"' lex.whitespace_split = True lex.commenters = '' return list(lex) def main(): parser = argparse.ArgumentParser(description="Re-sorting aligned files by read position") parser.add_argument('output_filename') parser.add_argument('--bam_filename') args = parser.parse_args() novo_sort(args.bam_filename, args.output_filename) if __name__ == "__main__": main()