annotate bwa_mem.py @ 1:ebb02ba5987c draft default tip

Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
author crs4
date Fri, 21 Mar 2014 12:56:15 -0400
parents 6820983ba5d5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
1 # -*- coding: utf-8 -*-
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
2 #!/usr/bin/env python
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
3 ## yufei.luo@gustave.roussy 22/07/2013
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
4 ## Copyright © 2014 CRS4 Srl. http://www.crs4.it/
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
5 ## Modified by:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
6 ## Nicola Soranzo <nicola.soranzo@crs4.it>
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
7
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
8 """
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
9 Runs BWA on single-end or paired-end data.
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
10 Produces a SAM file containing the mappings.
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
11 Works with BWA version >= 0.7.5.
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
12 NOTICE: In this wrapper, we only use 'mem' for mapping step.
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
13
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
14 usage: bwa_mem.py [options]
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
15
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
16 See below for options
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
17 """
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
18
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
19 import optparse, os, shutil, subprocess, sys, tempfile
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
20
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
21 def __main__():
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
22 descr = "bwa_mem.py: Map (long length) reads against a reference genome with BWA-MEM."
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
23 parser = optparse.OptionParser(description=descr)
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
24 parser.add_option( '-t', '--threads', default=1, help='The number of threads to use [1]' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
25 parser.add_option( '--ref', help='The reference genome to use or index' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
26 parser.add_option( '-f', '--fastq', help='The (forward) fastq file to use for the mapping' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
27 parser.add_option( '-F', '--rfastq', help='The reverse fastq file to use for mapping if paired-end data' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
28 parser.add_option( '-u', '--output', help='The file to save the output (SAM format)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
29 parser.add_option( '-g', '--genAlignType', help='The type of pairing (single or paired)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
30 parser.add_option( '--params', help='Parameter setting to use (pre_set or full)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
31 parser.add_option( '-s', '--fileSource', help='Whether to use a previously indexed reference sequence or one form history (indexed or history)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
32 parser.add_option( '-D', '--dbkey', help='Dbkey for reference genome' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
33
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
34 parser.add_option( '-k', '--minSeedLength', type=int, help='Minimum seed length [19]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
35 parser.add_option( '-w', '--bandWidth', type=int, help='Band width for banded alignment [100]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
36 parser.add_option( '-d', '--offDiagonal', type=int, help='Off-diagonal X-dropoff [100]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
37 parser.add_option( '-r', '--internalSeeds', type=float, help='Look for internal seeds inside a seed longer than {-k} * FLOAT [1.5]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
38 parser.add_option( '-c', '--seedsOccurrence', type=int, help='Skip seeds with more than INT occurrences [10000]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
39 parser.add_option( '-S', '--mateRescue', action='store_true', help='Skip mate rescue' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
40 parser.add_option( '-P', '--skipPairing', action='store_true', help='Skip pairing' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
41 parser.add_option( '-A', '--seqMatch', type=int, help='Score for a sequence match [1]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
42 parser.add_option( '-B', '--mismatch', type=int, help='Penalty for a mismatch [4]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
43 parser.add_option( '-O', '--gapOpen', type=int, help='Gap open penalty [6]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
44 parser.add_option( '-E', '--gapExtension', type=int, help='Gap extension penalty; a gap of length k costs {-O} + {-E}*k [1]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
45 parser.add_option( '-L', '--clipping', help='Penalty for clipping [5]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
46 parser.add_option( '-U', '--unpairedReadpair', type=int, help='Penalty for an unpaired read pair [17]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
47 parser.add_option( '-p', '--interPairEnd', action='store_true', help='FASTQ file consists of interleaved paired-end sequences' )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
48 parser.add_option( '--rgid', help='Read group identifier' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
49 parser.add_option( '--rgsm', help='Sample' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
50 parser.add_option( '--rgpl', choices=[ 'CAPILLARY', 'LS454', 'ILLUMINA', 'SOLID', 'HELICOS', 'IONTORRENT', 'PACBIO' ], help='Platform/technology used to produce the reads' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
51 parser.add_option( '--rglb', help='Library name' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
52 parser.add_option( '--rgpu', help='Platform unit (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
53 parser.add_option( '--rgcn', help='Sequencing center that produced the read' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
54 parser.add_option( '--rgds', help='Description' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
55 parser.add_option( '--rgdt', help='Date that run was produced (ISO8601 format date or date/time, like YYYY-MM-DD)' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
56 parser.add_option( '--rgfo', help='Flow order' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
57 parser.add_option( '--rgks', help='The array of nucleotide bases that correspond to the key sequence of each read' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
58 parser.add_option( '--rgpg', help='Programs used for processing the read group' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
59 parser.add_option( '--rgpi', help='Predicted median insert size' )
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
60 parser.add_option( '-T', '--minScore', type=int, help='Minimum score to output [30]' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
61 parser.add_option( '-a', '--outputAll', action='store_true', help='Output all found alignments for single-end or unpaired paired-end reads' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
62 parser.add_option( '-M', '--mark', action='store_true', help='Mark shorter split hits as secondary (for Picard/GATK compatibility)' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
63 parser.add_option( '-H', '--suppressHeader', dest='suppressHeader', action='store_true', help='Suppress header' )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
64 (options, args) = parser.parse_args()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
65 if len(args) > 0:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
66 parser.error('Wrong number of arguments')
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
67
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
68 # output version # of tool
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
69 try:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
70 tmp = tempfile.NamedTemporaryFile().name
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
71 tmp_stdout = open( tmp, 'wb' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
72 proc = subprocess.Popen( args='bwa 2>&1', shell=True, stdout=tmp_stdout )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
73 tmp_stdout.close()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
74 returncode = proc.wait()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
75 stdout = None
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
76 for line in open( tmp_stdout.name, 'rb' ):
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
77 if line.lower().find( 'version' ) >= 0:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
78 stdout = line.strip()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
79 break
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
80 if stdout:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
81 sys.stdout.write( 'BWA %s\n' % stdout )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
82 else:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
83 raise Exception
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
84 except:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
85 sys.stdout.write( 'Could not determine BWA version\n' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
86
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
87 fastq = options.fastq
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
88 if options.rfastq:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
89 rfastq = options.rfastq
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
90
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
91 # make temp directory for placement of indices
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
92 tmp_index_dir = tempfile.mkdtemp()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
93 tmp_dir = tempfile.mkdtemp()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
94 # index if necessary
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
95 if options.fileSource == 'history':
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
96 ref_file = tempfile.NamedTemporaryFile( dir=tmp_index_dir )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
97 ref_file_name = ref_file.name
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
98 ref_file.close()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
99 os.symlink( options.ref, ref_file_name )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
100 # determine which indexing algorithm to use, based on size
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
101 try:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
102 size = os.stat( options.ref ).st_size
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
103 if size <= 2**30:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
104 indexingAlg = 'is'
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
105 else:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
106 indexingAlg = 'bwtsw'
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
107 except:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
108 indexingAlg = 'is'
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
109 indexing_cmds = '-a %s' % indexingAlg
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
110 cmd1 = 'bwa index %s %s' % ( indexing_cmds, ref_file_name )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
111 try:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
112 tmp = tempfile.NamedTemporaryFile( dir=tmp_index_dir ).name
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
113 tmp_stderr = open( tmp, 'wb' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
114 proc = subprocess.Popen( args=cmd1, shell=True, cwd=tmp_index_dir, stderr=tmp_stderr.fileno() )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
115 returncode = proc.wait()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
116 tmp_stderr.close()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
117 # get stderr, allowing for case where it's very large
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
118 tmp_stderr = open( tmp, 'rb' )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
119 stderr = ''
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
120 buffsize = 1048576
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
121 try:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
122 while True:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
123 stderr += tmp_stderr.read( buffsize )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
124 if not stderr or len( stderr ) % buffsize != 0:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
125 break
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
126 except OverflowError:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
127 pass
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
128 tmp_stderr.close()
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
129 if returncode != 0:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
130 raise Exception, stderr
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
131 except Exception, e:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
132 # clean up temp dirs
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
133 if os.path.exists( tmp_index_dir ):
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
134 shutil.rmtree( tmp_index_dir )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
135 if os.path.exists( tmp_dir ):
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
136 shutil.rmtree( tmp_dir )
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
137 raise Exception, 'Error indexing reference sequence. ' + str( e )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
138 else:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
139 ref_file_name = options.ref
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
140 # if options.illumina13qual:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
141 # illumina_quals = "-I"
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
142 # else:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
143 # illumina_quals = ""
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
144
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
145 # set up aligning and generate aligning command args
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
146 start_cmds = "bwa mem -t %s" % options.threads
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
147 if options.interPairEnd:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
148 start_cmds += ' -p'
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
149 if options.params != 'pre_set':
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
150 if options.minSeedLength is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
151 start_cmds += " -k %d" % options.minSeedLength
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
152 if options.bandWidth is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
153 start_cmds += " -w %d" % options.bandWidth
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
154 if options.offDiagonal is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
155 start_cmds += " -d %d" % options.offDiagonal
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
156 if options.internalSeeds is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
157 start_cmds += " -r %s" % options.internalSeeds
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
158 if options.seedsOccurrence is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
159 start_cmds += " -c %d" % options.seedsOccurrence
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
160 if options.mateRescue:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
161 start_cmds += ' -S'
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
162 if options.skipPairing:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
163 start_cmds += ' -P'
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
164 if options.seqMatch is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
165 start_cmds += " -A %d" % options.seqMatch
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
166 if options.mismatch is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
167 start_cmds += " -B %d" % options.mismatch
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
168 if options.gapOpen is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
169 start_cmds += " -O %d" % options.gapOpen
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
170 if options.gapExtension is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
171 start_cmds += " -E %d" % options.gapExtension
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
172 if options.clipping:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
173 start_cmds += " -L %s" % options.clipping
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
174 if options.unpairedReadpair is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
175 start_cmds += " -U %d" % options.unpairedReadpair
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
176 if options.minScore is not None:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
177 start_cmds += " -T %d" % options.minScore
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
178 if options.outputAll:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
179 start_cmds += ' -a'
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
180 if options.mark:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
181 start_cmds += ' -M'
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
182 if options.rgid:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
183 if not options.rglb or not options.rgpl or not options.rgsm or not options.rglb:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
184 sys.exit( 'If you want to specify read groups, you must include the ID, LB, PL, and SM tags.' )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
185 readGroup = '@RG\tID:%s\tLB:%s\tPL:%s\tSM:%s' % ( options.rgid, options.rglb, options.rgpl, options.rgsm )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
186 if options.rgpu:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
187 readGroup += '\tPU:%s' % options.rgpu
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
188 if options.rgcn:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
189 readGroup += '\tCN:%s' % options.rgcn
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
190 if options.rgds:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
191 readGroup += '\tDS:%s' % options.rgds
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
192 if options.rgdt:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
193 readGroup += '\tDT:%s' % options.rgdt
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
194 if options.rgfo:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
195 readGroup += '\tFO:%s' % options.rgfo
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
196 if options.rgks:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
197 readGroup += '\tKS:%s' % options.rgks
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
198 if options.rgpg:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
199 readGroup += '\tPG:%s' % options.rgpg
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
200 if options.rgpi:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
201 readGroup += '\tPI:%s' % options.rgpi
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
202 start_cmds += " -R '%s'" % readGroup
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
203
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
204 if options.genAlignType == 'paired':
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
205 cmd = "%s %s %s %s > %s" % ( start_cmds, ref_file_name, fastq, rfastq, options.output )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
206 else:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
207 cmd = "%s %s %s > %s" % ( start_cmds, ref_file_name, fastq, options.output )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
208
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
209 # perform alignments
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
210 buffsize = 1048576
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
211 try:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
212 # need to nest try-except in try-finally to handle 2.4
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
213 try:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
214 tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
215 tmp_stderr = open( tmp, 'wb' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
216 print "The cmd is %s" % cmd
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
217 proc = subprocess.Popen( args=cmd, shell=True, cwd=tmp_dir, stderr=tmp_stderr.fileno() )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
218 returncode = proc.wait()
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
219 tmp_stderr.close()
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
220 # get stderr, allowing for case where it's very large
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
221 tmp_stderr = open( tmp, 'rb' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
222 stderr = ''
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
223 try:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
224 while True:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
225 stderr += tmp_stderr.read( buffsize )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
226 if not stderr or len( stderr ) % buffsize != 0:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
227 break
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
228 except OverflowError:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
229 pass
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
230 tmp_stderr.close()
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
231 if returncode != 0:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
232 raise Exception, stderr
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
233 except Exception, e:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
234 raise Exception, 'Error generating alignments. ' + str( e )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
235 # remove header if necessary
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
236 if options.suppressHeader:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
237 tmp_out = tempfile.NamedTemporaryFile( dir=tmp_dir)
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
238 tmp_out_name = tmp_out.name
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
239 tmp_out.close()
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
240 try:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
241 shutil.move( options.output, tmp_out_name )
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
242 except Exception, e:
1
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
243 raise Exception, 'Error moving output file before removing headers. ' + str( e )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
244 fout = file( options.output, 'w' )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
245 for line in file( tmp_out.name, 'r' ):
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
246 if not ( line.startswith( '@HD' ) or line.startswith( '@SQ' ) or line.startswith( '@RG' ) or line.startswith( '@PG' ) or line.startswith( '@CO' ) ):
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
247 fout.write( line )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
248 fout.close()
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
249 # check that there are results in the output file
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
250 if os.path.getsize( options.output ) > 0:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
251 sys.stdout.write( 'BWA run on %s-end data' % options.genAlignType )
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
252 else:
ebb02ba5987c Rewrite of param handling. interPairEnd param moved to "paired" section. Add param for '-a' option. Remove basic parallelism tag, which does not work with multiple inputs (thanks Bjoern Gruening for the notice). Simplify Python code.
crs4
parents: 0
diff changeset
253 raise Exception, 'The output file is empty. You may simply have no matches, or there may be an error with your input file or settings.'
0
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
254 finally:
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
255 # clean up temp dir
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
256 if os.path.exists( tmp_index_dir ):
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
257 shutil.rmtree( tmp_index_dir )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
258 if os.path.exists( tmp_dir ):
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
259 shutil.rmtree( tmp_dir )
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
260
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
261 if __name__ == "__main__":
6820983ba5d5 Uploaded
crs4
parents:
diff changeset
262 __main__()