Mercurial > repos > bgruening > bismark
annotate bismark_wrapper.py @ 8:9bfe38410155 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
author | bgruening |
---|---|
date | Wed, 22 Aug 2018 08:09:42 -0400 |
parents | |
children | 7bffcb6fc81d |
rev | line source |
---|---|
8
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
2 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
3 import argparse |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
4 import fileinput |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
5 import logging |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
6 import math |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
7 import os |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
8 import shutil |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
9 import subprocess |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
10 import sys |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
11 import tempfile |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
12 from glob import glob |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
13 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
14 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
15 def stop_err(logger, msg): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
16 logger.critical(msg) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
17 sys.exit(1) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
18 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
19 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
20 def log_subprocess_output(logger, pipe): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
21 for line in iter(pipe.readline, b''): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
22 logger.debug(line.decode().rstrip()) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
23 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
24 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
25 def __main__(): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
26 # Parse Command Line |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
27 parser = argparse.ArgumentParser(description='Wrapper for the bismark bisulfite mapper.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
28 parser.add_argument('-p', '--num-threads', dest='num_threads', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
29 type=int, default=4, help='Use this many threads to align reads. The default is 4.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
30 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
31 # input options |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
32 parser.add_argument('--own-file', dest='own_file', help='') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
33 parser.add_argument('-D', '--indexes-path', dest='index_path', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
34 help='Indexes directory; location of .ebwt and .fa files.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
35 parser.add_argument('-O', '--output', dest='output') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
36 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
37 parser.add_argument('--output-report-file', dest='output_report_file') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
38 parser.add_argument('--suppress-header', dest='suppress_header', action="store_true") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
39 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
40 parser.add_argument('--mate-paired', dest='mate_paired', action='store_true', help='Reads are mate-paired', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
41 default=False) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
42 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
43 parser.add_argument('-1', '--mate1', dest='mate1', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
44 help='The forward reads file in Sanger FASTQ or FASTA format.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
45 parser.add_argument('-2', '--mate2', dest='mate2', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
46 help='The reverse reads file in Sanger FASTQ or FASTA format.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
47 parser.add_argument('--sort-bam', dest='sort_bam', action="store_true") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
48 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
49 parser.add_argument('--output-unmapped-reads', dest='output_unmapped_reads', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
50 help='Additional output file with unmapped reads (single-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
51 parser.add_argument('--output-unmapped-reads-l', dest='output_unmapped_reads_l', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
52 help='File name for unmapped reads (left, paired-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
53 parser.add_argument('--output-unmapped-reads-r', dest='output_unmapped_reads_r', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
54 help='File name for unmapped reads (right, paired-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
55 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
56 parser.add_argument('--output-suppressed-reads', dest='output_suppressed_reads', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
57 help='Additional output file with suppressed reads (single-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
58 parser.add_argument('--output-suppressed-reads-l', dest='output_suppressed_reads_l', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
59 help='File name for suppressed reads (left, paired-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
60 parser.add_argument('--output-suppressed-reads-r', dest='output_suppressed_reads_r', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
61 help='File name for suppressed reads (right, paired-end).') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
62 parser.add_argument('--stdout', dest='output_stdout', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
63 help='File name for the standard output of bismark.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
64 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
65 parser.add_argument('--single-paired', dest='single_paired', |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
66 help='The single-end reads file in Sanger FASTQ or FASTA format.') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
67 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
68 parser.add_argument('--fastq', action='store_true', help='Query filetype is in FASTQ format') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
69 parser.add_argument('--fasta', action='store_true', help='Query filetype is in FASTA format') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
70 parser.add_argument('--phred64-quals', dest='phred64', action="store_true") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
71 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
72 parser.add_argument('--skip-reads', dest='skip_reads', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
73 parser.add_argument('--qupto', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
74 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
75 # paired end options |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
76 parser.add_argument('-I', '--minins', dest='min_insert') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
77 parser.add_argument('-X', '--maxins', dest='max_insert') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
78 parser.add_argument('--no-mixed', dest='no_mixed', action="store_true") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
79 parser.add_argument('--no-discordant', dest='no_discordant', action="store_true") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
80 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
81 # parse general options |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
82 # default 20 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
83 parser.add_argument('--seed-len', dest='seed_len', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
84 # default 15 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
85 parser.add_argument('--seed-extention-attempts', dest='seed_extention_attempts', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
86 # default 0 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
87 parser.add_argument('--seed-mismatches', dest='seed_mismatches', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
88 # default 2 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
89 parser.add_argument('--max-reseed', dest='max_reseed', type=int) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
90 """ |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
91 # default 70 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
92 parser.add_argument( '--maqerr', dest='maqerr', type=int ) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
93 """ |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
94 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
95 """ |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
96 The number of megabytes of memory a given thread is given to store path |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
97 descriptors in --best mode. Best-first search must keep track of many paths |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
98 at once to ensure it is always extending the path with the lowest cumulative |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
99 cost. Bowtie tries to minimize the memory impact of the descriptors, but |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
100 they can still grow very large in some cases. If you receive an error message |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
101 saying that chunk memory has been exhausted in --best mode, try adjusting |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
102 this parameter up to dedicate more memory to the descriptors. Default: 512. |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
103 """ |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
104 parser.add_argument('--chunkmbs', type=int, default=512) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
105 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
106 args = parser.parse_args() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
107 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
108 logger = logging.getLogger('bismark_wrapper') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
109 logger.setLevel(logging.DEBUG) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
110 ch = logging.StreamHandler(sys.stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
111 if args.output_stdout: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
112 ch.setLevel(logging.WARNING) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
113 handler = logging.FileHandler(args.output_stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
114 handler.setLevel(logging.DEBUG) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
115 logger.addHandler(handler) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
116 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
117 ch.setLevel(logging.DEBUG) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
118 logger.addHandler(ch) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
119 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
120 # Create bismark index if necessary. |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
121 index_dir = "" |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
122 tmp_index_dir = None |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
123 if args.own_file: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
124 logger.info("Create a temporary index with the offered files from the user. " |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
125 "Utilizing the script: bismark_genome_preparation") |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
126 tmp_index_dir = tempfile.mkdtemp() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
127 index_path = os.path.join(tmp_index_dir, '.'.join(os.path.split(args.own_file)[1].split('.')[:-1])) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
128 try: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
129 # Create a hard link pointing to args.own_file named 'index_path'.fa. |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
130 os.symlink(args.own_file, index_path + '.fa') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
131 except Exception as e: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
132 if os.path.exists(tmp_index_dir): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
133 shutil.rmtree(tmp_index_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
134 stop_err(logger, 'Error in linking the reference database!\n%s' % e) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
135 # bismark_genome_preparation needs the complete path to the folder in which the database is stored |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
136 cmd_index = ['bismark_genome_preparation', '--bowtie2', tmp_index_dir] |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
137 try: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
138 logger.info("Generating index with: '%s'", " ".join(cmd_index)) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
139 process = subprocess.Popen(cmd_index, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
140 with process.stdout: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
141 log_subprocess_output(logger, process.stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
142 exitcode = process.wait() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
143 if exitcode != 0: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
144 raise Exception(process.stderr) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
145 except Exception as e: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
146 if os.path.exists(tmp_index_dir): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
147 shutil.rmtree(tmp_index_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
148 stop_err(logger, 'Error indexing reference sequence!\n%s' % e) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
149 index_dir = tmp_index_dir |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
150 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
151 # bowtie path is the path to the index directory and the first path of the index file name |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
152 index_dir = os.path.dirname(args.index_path) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
153 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
154 # Build bismark command |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
155 tmp_bismark_dir = tempfile.mkdtemp() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
156 output_dir = os.path.join(tmp_bismark_dir, 'results') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
157 cmd = ['bismark', '--bam', '--gzip', '--temp_dir', tmp_bismark_dir, '-o', output_dir, '--quiet'] |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
158 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
159 if args.fasta: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
160 # the query input files (specified as mate1,mate2 or singles) are FastA |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
161 cmd.append('--fasta') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
162 elif args.fastq: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
163 cmd.append('--fastq') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
164 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
165 # alignment options |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
166 if args.num_threads > 2: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
167 # divide num_threads by 2 here since bismark will spawn 2 jobs with -p threads each |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
168 cmd.extend(['-p', str(math.ceil(args.num_threads / 2))]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
169 if args.seed_mismatches: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
170 cmd.extend(['-N', str(args.seed_mismatches)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
171 if args.seed_len: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
172 cmd.extend(['-L', str(args.seed_len)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
173 if args.seed_extention_attempts: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
174 cmd.extend(['-D', str(args.seed_extention_attempts)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
175 if args.max_reseed: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
176 cmd.extend(['-R', str(args.max_reseed)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
177 if args.no_discordant: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
178 cmd.append('--no-discordant') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
179 if args.no_mixed: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
180 cmd.append('--no-mixed') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
181 if args.skip_reads: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
182 cmd.extend(['--skip', str(args.skip_reads)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
183 if args.qupto: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
184 cmd.extend(['--upto', 'args.qupto']) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
185 if args.phred64: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
186 cmd.append('--phred64-quals') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
187 if args.suppress_header: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
188 cmd.append('--sam-no-hd') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
189 if args.output_unmapped_reads or (args.output_unmapped_reads_l and args.output_unmapped_reads_r): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
190 cmd.append('--un') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
191 if args.output_suppressed_reads or (args.output_suppressed_reads_l and args.output_suppressed_reads_r): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
192 cmd.append('--ambiguous') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
193 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
194 cmd.append(index_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
195 # Set up the reads |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
196 if args.mate_paired: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
197 # paired-end reads library |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
198 cmd.extend(['-1', args.mate1, '-2', args.mate2, '-I', str(args.min_insert), '-X', str(args.max_insert)]) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
199 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
200 # single paired reads library |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
201 cmd.append(args.single_paired) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
202 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
203 # Run |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
204 try: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
205 logger.info("Running bismark with: '%s'", " ".join(cmd)) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
206 process = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
207 with process.stdout: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
208 log_subprocess_output(logger, process.stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
209 exitcode = process.wait() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
210 if exitcode != 0: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
211 raise Exception(process.stderr) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
212 except Exception as e: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
213 stop_err(logger, 'Error in running bismark!\n%s' % e) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
214 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
215 # collect and copy output files |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
216 if args.output_report_file: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
217 output_report_file = open(args.output_report_file, 'w+') |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
218 for line in fileinput.input(glob(os.path.join(output_dir, '*report.txt'))): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
219 output_report_file.write(line) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
220 output_report_file.close() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
221 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
222 if args.output_suppressed_reads: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
223 if glob(os.path.join(output_dir, '*ambiguous_reads.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
224 shutil.move(glob(os.path.join(output_dir, '*ambiguous_reads.txt'))[0], args.output_suppressed_reads) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
225 if args.output_suppressed_reads_l: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
226 if glob(os.path.join(output_dir, '*ambiguous_reads_1.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
227 shutil.move(glob(os.path.join(output_dir, '*ambiguous_reads_1.txt'))[0], args.output_suppressed_reads_l) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
228 if args.output_suppressed_reads_r: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
229 if glob(os.path.join(output_dir, '*ambiguous_reads_2.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
230 shutil.move(glob(os.path.join(output_dir, '*ambiguous_reads_2.txt'))[0], args.output_suppressed_reads_r) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
231 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
232 if args.output_unmapped_reads: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
233 if glob(os.path.join(output_dir, '*unmapped_reads.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
234 shutil.move(glob(os.path.join(output_dir, '*unmapped_reads.txt'))[0], args.output_unmapped_reads) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
235 if args.output_unmapped_reads_l: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
236 if glob(os.path.join(output_dir, '*unmapped_reads_1.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
237 shutil.move(glob(os.path.join(output_dir, '*unmapped_reads_1.txt'))[0], args.output_unmapped_reads_l) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
238 if args.output_unmapped_reads_r: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
239 if glob(os.path.join(output_dir, '*unmapped_reads_2.txt')): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
240 shutil.move(glob(os.path.join(output_dir, '*unmapped_reads_2.txt'))[0], args.output_unmapped_reads_r) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
241 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
242 try: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
243 # merge all bam files |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
244 tmp_res = tempfile.NamedTemporaryFile(dir=output_dir).name |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
245 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
246 bam_files = glob(os.path.join(output_dir, '*.bam')) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
247 if len(bam_files) > 1: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
248 cmd = ['samtools', 'merge', '-@', str(args.num_threads), '-f', tmp_res, ' '.join(bam_files)] |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
249 logger.info("Merging bams with: '%s'", cmd) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
250 process = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
251 with process.stdout: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
252 log_subprocess_output(logger, process.stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
253 exitcode = process.wait() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
254 if exitcode != 0: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
255 raise Exception(process.stderr) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
256 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
257 tmp_res = bam_files[0] |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
258 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
259 bam_path = "%s" % tmp_res |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
260 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
261 if os.path.exists(bam_path): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
262 if args.sort_bam: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
263 cmd = ['samtools', 'sort', '-@', str(args.num_threads), bam_path, 'sorted_bam'] |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
264 logger.info("Sorting bam with: '%s'", cmd) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
265 process = subprocess.Popen(args=cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
266 with process.stdout: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
267 log_subprocess_output(logger, process.stdout) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
268 exitcode = process.wait() |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
269 if exitcode != 0: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
270 raise Exception(process.stderr) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
271 shutil.move('sorted_bam.bam', args.output) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
272 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
273 shutil.move(bam_path, args.output) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
274 else: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
275 stop_err(logger, 'BAM file no found:\n%s' % bam_path) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
276 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
277 except Exception as e: |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
278 stop_err(logger, 'Error in merging bam files!\n%s' % e) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
279 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
280 # Clean up temp dirs |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
281 if tmp_index_dir and os.path.exists(tmp_index_dir): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
282 shutil.rmtree(tmp_index_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
283 if os.path.exists(tmp_bismark_dir): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
284 shutil.rmtree(tmp_bismark_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
285 if os.path.exists(output_dir): |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
286 shutil.rmtree(output_dir) |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
287 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
288 |
9bfe38410155
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/bismark commit 51299fa62f0566a4a897b1c149db564631282fff
bgruening
parents:
diff
changeset
|
289 if __name__ == "__main__": __main__() |