Mercurial > repos > rnateam > bctools
comparison extract_aln_ends.py @ 50:0b9aab6aaebf draft
Uploaded 16cfcafe8b42055c5dd64e62c42b82b455027a40
author | rnateam |
---|---|
date | Tue, 26 Jan 2016 04:38:27 -0500 |
parents | 570a7de9f151 |
children |
comparison
equal
deleted
inserted
replaced
49:303f6402a035 | 50:0b9aab6aaebf |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | |
3 import argparse | |
4 import logging | |
5 from sys import stdout | |
6 from shutil import rmtree | |
7 from tempfile import mkdtemp | |
8 from pybedtools import BedTool | |
9 import pysam | |
10 # avoid ugly python IOError when stdout output is piped into another program | |
11 # and then truncated (such as piping to head) | |
12 from signal import signal, SIGPIPE, SIG_DFL | |
13 signal(SIGPIPE, SIG_DFL) | |
2 | 14 |
3 tool_description = """ | 15 tool_description = """ |
4 Extract alignment ends from sam file. | 16 Extract alignment ends from sam file. |
5 | 17 |
6 The resulting bed file contains the outer coordinates of the alignments. The | 18 The resulting bed file contains the outer coordinates of the alignments. The |
30 License: Apache | 42 License: Apache |
31 Email: maticzkd@informatik.uni-freiburg.de | 43 Email: maticzkd@informatik.uni-freiburg.de |
32 Status: Development | 44 Status: Development |
33 """ | 45 """ |
34 | 46 |
35 import argparse | |
36 import logging | |
37 from sys import stdout | |
38 from shutil import rmtree | |
39 from tempfile import mkdtemp | |
40 from pybedtools import BedTool | |
41 import pysam | |
42 | |
43 | 47 |
44 class DefaultsRawDescriptionHelpFormatter(argparse.ArgumentDefaultsHelpFormatter, | 48 class DefaultsRawDescriptionHelpFormatter(argparse.ArgumentDefaultsHelpFormatter, |
45 argparse.RawDescriptionHelpFormatter): | 49 argparse.RawDescriptionHelpFormatter): |
46 # To join the behaviour of RawDescriptionHelpFormatter with that of ArgumentDefaultsHelpFormatter | 50 # To join the behaviour of RawDescriptionHelpFormatter with that of ArgumentDefaultsHelpFormatter |
47 pass | 51 pass |
48 | |
49 # avoid ugly python IOError when stdout output is piped into another program | |
50 # and then truncated (such as piping to head) | |
51 from signal import signal, SIGPIPE, SIG_DFL | |
52 signal(SIGPIPE, SIG_DFL) | |
53 | 52 |
54 # parse command line arguments | 53 # parse command line arguments |
55 parser = argparse.ArgumentParser(description=tool_description, | 54 parser = argparse.ArgumentParser(description=tool_description, |
56 epilog=epilog, | 55 epilog=epilog, |
57 formatter_class=DefaultsRawDescriptionHelpFormatter) | 56 formatter_class=DefaultsRawDescriptionHelpFormatter) |