From b5fa09009241a00685617f7a0d184cb73711bc30 Mon Sep 17 00:00:00 2001 From: Kelly Vincent Date: Mon, 11 Jan 2010 17:04:45 -0500 Subject: [PATCH] Added SOLiD (colorspace) support to Bowtie wrapper tool --- tool-data/bowtie_indices_color.loc.sample | 31 + tools/sr_mapping/bowtie_wrapper.py | 447 +++++-- tools/sr_mapping/bowtie_wrapper.xml | 1391 +++++++++++++++------ tools/sr_mapping/bowtie_wrapper_code.py | 18 +- 4 files changed, 1365 insertions(+), 522 deletions(-) create mode 100644 tool-data/bowtie_indices_color.loc.sample diff --git a/tool-data/bowtie_indices_color.loc.sample b/tool-data/bowtie_indices_color.loc.sample new file mode 100644 index 00000000000..69cb0d74590 --- /dev/null +++ b/tool-data/bowtie_indices_color.loc.sample @@ -0,0 +1,31 @@ +#This is a sample file distributed with Galaxy that enables tools +#to use a directory of colorspace Bowtie indexed sequences data files. +#You will need to create these data files and then create a +#bowtie_indices_color.loc file similar to this one (store it in this +#directory) that points to the directories in which those files are +#stored. The bowtie_indices_color.loc file has this format (white +#space characters are TAB characters): +# +# +# +#So, for example, if you had hg18 indexed stored in +#/depot/data2/galaxy/bowtie/hg18/, +#then the bowtie_indices_color.loc entry would look like this: +# +#hg18 /depot/data2/galaxy/bowtie/hg18/hg18 +# +#and your /depot/data2/galaxy/bowtie/hg18/ directory +#would contain hg18.*.ebwt files: +# +#-rw-r--r-- 1 james universe 830134 2005-09-13 10:12 hg18.1.ebwt +#-rw-r--r-- 1 james universe 527388 2005-09-13 10:12 hg18.2.ebwt +#-rw-r--r-- 1 james universe 269808 2005-09-13 10:12 gh18.3.ebwt +#...etc... +# +#Your bowtie_indices_color.loc file should include an entry per line +#for each index set you have stored. The "file" in the path does not +#actually exist, but it is the prefix for the actual index files. For +#example: +# +#hg18 /depot/data2/galaxy/bowtie/hg18/hg18 +#hg19 /depot/data2/galaxy/bowtie/hg19/hg19 diff --git a/tools/sr_mapping/bowtie_wrapper.py b/tools/sr_mapping/bowtie_wrapper.py index 6be31194ee1..b3ac518a920 100644 --- a/tools/sr_mapping/bowtie_wrapper.py +++ b/tools/sr_mapping/bowtie_wrapper.py @@ -2,6 +2,61 @@ """ Runs Bowtie on single-end or paired-end data. +For use with Bowtie v. 0.12.1 + +usage: bowtie_wrapper.py [options] + -t, --threads=t: The number of threads to run + -i, --input1=i: The (forward or single-end) reads file in Sanger FASTQ format + -I, --input2=I: The reverse reads file in Sanger FASTQ format + -o, --output=o: The output file + -4, --dataType=4: The type of data (SOLiD or Solexa) + -2, --paired=2: Whether the data is single- or paired-end + -g, --genomeSource=g: The type of reference provided + -r, --ref=r: The reference genome to use or index + -s, --skip=s: Skip the first n reads + -a, --alignLimit=a: Only align the first n reads + -T, --trimH=T: Trim n bases from high-quality (left) end of each read before alignment + -L, --trimL=L: Trim n bases from low-quality (right) end of each read before alignment + -m, --mismatchSeed=m: Maximum number of mismatches permitted in the seed + -M, --mismatchQual=M: Maximum permitted total of quality values at mismatched read positions + -l, --seedLen=l: Seed length + -n, --rounding=n: Whether or not to round to the nearest 10 and saturating at 30 + -P, --maqSoapAlign=P: Choose MAQ- or SOAP-like alignment policy + -w, --tryHard=: Whether or not to try as hard as possible to find valid alignments when they exist + -v, --valAlign=v: Report up to n valid arguments per read + -V, --allValAligns=V: Whether or not to report all valid alignments per read + -G, --suppressAlign=G: Suppress all alignments for a read if more than n reportable alignments exist + -b, --best=b: Whether or not to make Bowtie guarantee that reported singleton alignments are 'best' in terms of stratum and in terms of the quality values at the mismatched positions + -B, --maxBacktracks=B: Maximum number of backtracks permitted when aligning a read + -R, --strata=R: Whether or not to report only those alignments that fall in the best stratum if many valid alignments exist and are reportable + -j, --minInsert=j: Minimum insert size for valid paired-end alignments + -J, --maxInsert=J: Maximum insert size for valid paired-end alignments + -O, --mateOrient=O: The upstream/downstream mate orientation for valid paired-end alignment against the forward reference strand + -A, --maxAlignAttempt=A: Maximum number of attempts Bowtie will make to match an alignment for one mate with an alignment for the opposite mate + -f, --forwardAlign=f: Whether or not to attempt to align the forward reference strand + -E, --reverseAlign=E: Whether or not to attempt to align the reverse-complement reference strand + -F, --offrate=F: Override the offrate of the index to n + -8, --snpphred=8: SNP penalty on Phred scale + -6, --snpfrac=6: Fraction of sites expected to be SNP sites + -7, --keepends=7: Keep extreme-end nucleotides and qualities + -S, --seed=S: Seed for pseudo-random number generator + -d, --dbkey=d: Dbkey of reference genome + -C, --params=C: Whether to use default or specified parameters + -u, --iauto_b=u: Automatic or specified behavior + -K, --ipacked=K: Whether or not to use a packed representation for DNA strings + -Q, --ibmax=Q: Maximum number of suffixes allowed in a block + -Y, --ibmaxdivn=Y: Maximum number of suffixes allowed in a block as a fraction of the length of the reference + -D, --idcv=D: The period for the difference-cover sample + -U, --inodc=U: Whether or not to disable the use of the difference-cover sample + -y, --inoref=y: Whether or not to build the part of the reference index used only in paired-end alignment + -z, --ioffrate=z: How many rows get marked during annotation of some or all of the Burrows-Wheeler rows + -W, --iftab=W: The size of the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query + -X, --intoa=X: Whether or not to convert Ns in the reference sequence to As + -N, --iendian=N: Endianness to use when serializing integers to the index file + -Z, --iseed=Z: Seed for the pseudorandom number generator + -c, --icutoff=c: Number of first bases of the reference sequence to index + -x, --indexSettings=x: Whether or not indexing options are to be set + -H, --suppressHeader=H: Suppress header """ import optparse, os, shutil, sys, tempfile @@ -13,161 +68,281 @@ def stop_err( msg ): def __main__(): #Parse Command Line parser = optparse.OptionParser() - parser.add_option('', '--threads', dest='threads', help='The number of threads to run') - parser.add_option('', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format') - parser.add_option('', '--input2', dest='input2', help='The reverse reads file in Sanger FASTQ format') - parser.add_option('', '--output', dest='output', help='The output file') - parser.add_option('', '--paired', dest='paired', help='Whether the data is single- or paired-end') - parser.add_option('', '--genomeSource', dest='genomeSource', help='The type of reference provided') - parser.add_option('', '--ref', dest='ref', help='The reference genome to use or index') - parser.add_option('', '--skip', dest='skip', help='Skip the first n reads') - parser.add_option('', '--alignLimit', dest='alignLimit', help='Only align the first n reads') - parser.add_option('', '--trimH', dest='trimH', help='Trim n bases from high-quality (left) end of each read before alignment') - parser.add_option('', '--trimL', dest='trimL', help='Trim n bases from low-quality (right) end of each read before alignment') - parser.add_option('', '--mismatchSeed', dest='mismatchSeed', help='Maximum number of mismatches permitted in the seed') - parser.add_option('', '--mismatchQual', dest='mismatchQual', help='Maximum permitted total of quality values at mismatched read positions') - parser.add_option('', '--seedLen', dest='seedLen', help='Seed length') - parser.add_option('', '--rounding', dest='rounding', help='Whether or not to round to the nearest 10 and saturating at 30') - parser.add_option('', '--maqSoapAlign', dest='maqSoapAlign', help='Choose MAQ- or SOAP-like alignment policy') - parser.add_option('', '--tryHard', dest='tryHard', help='Whether or not to try as hard as possible to find valid alignments when they exist') - parser.add_option('', '--valAlign', dest='valAlign', help='Report up to n valid arguments per read') - parser.add_option('', '--allValAligns', dest='allValAligns', help='Whether or not to report all valid alignments per read') - parser.add_option('', '--suppressAlign', dest='suppressAlign', help='Suppress all alignments for a read if more than n reportable alignments exist') - parser.add_option('', '--best', dest='best', help="Whether or not to make Bowtie guarantee that reported singleton alignments are 'best' in terms of stratum and in terms of the quality values at the mismatched positions") - parser.add_option('', '--maxBacktracks', dest='maxBacktracks', help='Maximum number of backtracks permitted when aligning a read') - parser.add_option('', '--strata', dest='strata', help='Whether or not to report only those alignments that fall in the best stratum if many valid alignments exist and are reportable') - parser.add_option('', '--minInsert', dest='minInsert', help='Minimum insert size for valid paired-end alignments') - parser.add_option('', '--maxInsert', dest='maxInsert', help='Maximum insert size for valid paired-end alignments') - parser.add_option('', '--mateOrient', dest='mateOrient', help='The upstream/downstream mate orientation for valid paired-end alignment against the forward reference strand') - parser.add_option('', '--maxAlignAttempt', dest='maxAlignAttempt', help='Maximum number of attempts Bowtie will make to match an alignment for one mate with an alignment for the opposite mate') - parser.add_option('', '--forwardAlign', dest='forwardAlign', help='Whether or not to attempt to align the forward reference strand') - parser.add_option('', '--reverseAlign', dest='reverseAlign', help='Whether or not to attempt to align the reverse-complement reference strand') - parser.add_option('', '--offrate', dest='offrate', help='Override the offrate of the index to n') - parser.add_option('', '--seed', dest='seed', help='Seed for pseudo-random number generator') - parser.add_option('', '--dbkey', dest='dbkey', help='') - parser.add_option('', '--params', dest='params', help='Whether to use default or specified parameters') - parser.add_option('', '--iauto_b', dest='iauto_b', help='Automatic or specified behavior') - parser.add_option('', '--ipacked', dest='ipacked', help='Whether or not to use a packed representation for DNA strings') - parser.add_option('', '--ibmax', dest='ibmax', help='Maximum number of suffixes allowed in a block') - parser.add_option('', '--ibmaxdivn', dest='ibmaxdivn', help='Maximum number of suffixes allowed in a block as a fraction of the length of the reference') - parser.add_option('', '--idcv', dest='idcv', help='The period for the difference-cover sample') - parser.add_option('', '--inodc', dest='inodc', help='Whether or not to disable the use of the difference-cover sample') - parser.add_option('', '--inoref', dest='inoref', help='Whether or not to build the part of the reference index used only in paried-end alignment') - parser.add_option('', '--ioffrate', dest='ioffrate', help='How many rows get marked during annotation of some or all of the Burrows-Wheeler rows') - parser.add_option('', '--iftab', dest='iftab', help='The size of the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query') - parser.add_option('', '--intoa', dest='intoa', help='Whether or not to convert Ns in the reference sequence to As') - parser.add_option('', '--iendian', dest='iendian', help='Endianness to use when serializing integers to the index file') - parser.add_option('', '--iseed', dest='iseed', help='Seed for the pseudorandom number generator') - parser.add_option('', '--icutoff', dest='icutoff', help='Number of first bases of the reference sequence to index') - parser.add_option('', '--indexSettings', dest='index_settings', help='Whether or not indexing options are to be set') - parser.add_option('', '--suppressHeader', dest='suppressHeader', help='Suppress header') + parser.add_option( '-t', '--threads', dest='threads', help='The number of threads to run' ) + parser.add_option( '-4', '--dataType', dest='dataType', help='The type of data (SOLiD or Solexa)' ) + parser.add_option( '-i', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format' ) + parser.add_option( '-I', '--input2', dest='input2', help='The reverse reads file in Sanger FASTQ format' ) + parser.add_option( '-o', '--output', dest='output', help='The output file' ) + parser.add_option( '-2', '--paired', dest='paired', help='Whether the data is single- or paired-end' ) + parser.add_option( '-g', '--genomeSource', dest='genomeSource', help='The type of reference provided' ) + parser.add_option( '-r', '--ref', dest='ref', help='The reference genome to use or index' ) + parser.add_option( '-s', '--skip', dest='skip', help='Skip the first n reads' ) + parser.add_option( '-a', '--alignLimit', dest='alignLimit', help='Only align the first n reads' ) + parser.add_option( '-T', '--trimH', dest='trimH', help='Trim n bases from high-quality (left) end of each read before alignment' ) + parser.add_option( '-L', '--trimL', dest='trimL', help='Trim n bases from low-quality (right) end of each read before alignment' ) + parser.add_option( '-m', '--mismatchSeed', dest='mismatchSeed', help='Maximum number of mismatches permitted in the seed' ) + parser.add_option( '-M', '--mismatchQual', dest='mismatchQual', help='Maximum permitted total of quality values at mismatched read positions' ) + parser.add_option( '-l', '--seedLen', dest='seedLen', help='Seed length' ) + parser.add_option( '-n', '--rounding', dest='rounding', help='Whether or not to round to the nearest 10 and saturating at 30' ) + parser.add_option( '-P', '--maqSoapAlign', dest='maqSoapAlign', help='Choose MAQ- or SOAP-like alignment policy' ) + parser.add_option( '-w', '--tryHard', dest='tryHard', help='Whether or not to try as hard as possible to find valid alignments when they exist' ) + parser.add_option( '-v', '--valAlign', dest='valAlign', help='Report up to n valid arguments per read' ) + parser.add_option( '-V', '--allValAligns', dest='allValAligns', help='Whether or not to report all valid alignments per read' ) + parser.add_option( '-G', '--suppressAlign', dest='suppressAlign', help='Suppress all alignments for a read if more than n reportable alignments exist' ) + parser.add_option( '-b', '--best', dest='best', help="Whether or not to make Bowtie guarantee that reported singleton alignments are 'best' in terms of stratum and in terms of the quality values at the mismatched positions" ) + parser.add_option( '-B', '--maxBacktracks', dest='maxBacktracks', help='Maximum number of backtracks permitted when aligning a read' ) + parser.add_option( '-R', '--strata', dest='strata', help='Whether or not to report only those alignments that fall in the best stratum if many valid alignments exist and are reportable' ) + parser.add_option( '-j', '--minInsert', dest='minInsert', help='Minimum insert size for valid paired-end alignments' ) + parser.add_option( '-J', '--maxInsert', dest='maxInsert', help='Maximum insert size for valid paired-end alignments' ) + parser.add_option( '-O', '--mateOrient', dest='mateOrient', help='The upstream/downstream mate orientation for valid paired-end alignment against the forward reference strand' ) + parser.add_option( '-A', '--maxAlignAttempt', dest='maxAlignAttempt', help='Maximum number of attempts Bowtie will make to match an alignment for one mate with an alignment for the opposite mate' ) + parser.add_option( '-f', '--forwardAlign', dest='forwardAlign', help='Whether or not to attempt to align the forward reference strand' ) + parser.add_option( '-E', '--reverseAlign', dest='reverseAlign', help='Whether or not to attempt to align the reverse-complement reference strand' ) + parser.add_option( '-F', '--offrate', dest='offrate', help='Override the offrate of the index to n' ) + parser.add_option( '-S', '--seed', dest='seed', help='Seed for pseudo-random number generator' ) + parser.add_option( '-8', '--snpphred', dest='snpphred', help='SNP penalty on Phred scale' ) + parser.add_option( '-6', '--snpfrac', dest='snpfrac', help='Fraction of sites expected to be SNP sites' ) + parser.add_option( '-7', '--keepends', dest='keepends', help='Keep extreme-end nucleotides and qualities' ) + parser.add_option( '-d', '--dbkey', dest='dbkey', help='Dbkey of reference genome' ) + parser.add_option( '-C', '--params', dest='params', help='Whether to use default or specified parameters' ) + parser.add_option( '-u', '--iauto_b', dest='iauto_b', help='Automatic or specified behavior' ) + parser.add_option( '-K', '--ipacked', dest='ipacked', help='Whether or not to use a packed representation for DNA strings' ) + parser.add_option( '-Q', '--ibmax', dest='ibmax', help='Maximum number of suffixes allowed in a block' ) + parser.add_option( '-Y', '--ibmaxdivn', dest='ibmaxdivn', help='Maximum number of suffixes allowed in a block as a fraction of the length of the reference' ) + parser.add_option( '-D', '--idcv', dest='idcv', help='The period for the difference-cover sample' ) + parser.add_option( '-U', '--inodc', dest='inodc', help='Whether or not to disable the use of the difference-cover sample' ) + parser.add_option( '-y', '--inoref', dest='inoref', help='Whether or not to build the part of the reference index used only in paired-end alignment' ) + parser.add_option( '-z', '--ioffrate', dest='ioffrate', help='How many rows get marked during annotation of some or all of the Burrows-Wheeler rows' ) + parser.add_option( '-W', '--iftab', dest='iftab', help='The size of the lookup table used to calculate an initial Burrows-Wheeler range with respect to the first n characters of the query' ) + parser.add_option( '-X', '--intoa', dest='intoa', help='Whether or not to convert Ns in the reference sequence to As' ) + parser.add_option( '-N', '--iendian', dest='iendian', help='Endianness to use when serializing integers to the index file' ) + parser.add_option( '-Z', '--iseed', dest='iseed', help='Seed for the pseudorandom number generator' ) + parser.add_option( '-c', '--icutoff', dest='icutoff', help='Number of first bases of the reference sequence to index' ) + parser.add_option( '-x', '--indexSettings', dest='index_settings', help='Whether or not indexing options are to be set' ) + parser.add_option( '-H', '--suppressHeader', dest='suppressHeader', help='Suppress header' ) (options, args) = parser.parse_args() # make temp directory for placement of indices and copy reference file there if necessary tmp_index_dir = tempfile.mkdtemp() + # get type of data (solid or solexa) + if options.dataType == 'solid': + colorspace = '-C' + else: + colorspace = '' # index if necessary - if options.genomeSource == 'history': + if options.genomeSource == 'cHistory' or options.genomeSource == 'xHistory': # set up commands - if options.index_settings =='index_pre_set': - indexing_cmds = '' + if options.index_settings =='cIndexPreSet' or options.index_settings == 'xIndexPreSet': + indexing_cmds = '%s' % colorspace else: try: - indexing_cmds = '%s %s %s %s %s %s %s --offrate %s %s %s %s %s %s' % \ - (('','--noauto')[options.iauto_b=='set'], - ('','--packed')[options.ipacked=='packed'], - ('','--bmax %s'%options.ibmax)[options.ibmax!='None' and options.ibmax>=1], - ('','--bmaxdivn %s'%options.ibmaxdivn)[options.ibmaxdivn!='None'], - ('','--dcv %s'%options.idcv)[options.idcv!='None'], - ('','--nodc')[options.inodc=='nodc'], - ('','--noref')[options.inoref=='noref'], options.ioffrate, - ('','--ftabchars %s'%options.iftab)[int(options.iftab)>=0], - ('','--ntoa')[options.intoa=='yes'], - ('--little','--big')[options.iendian=='big'], - ('','--seed %s'%options.iseed)[int(options.iseed)>0], - ('','--cutoff %s'%options.icutoff)[int(options.icutoff)>0]) + if options.iauto_b == 'set': + iauto_b = '--noauto' + else: + iauto_b = '' + if options.ipacked == 'packed': + ipacked = '--packed' + else: + ipacked = '' + if options.ibmax != 'None' and int( options.ibmax ) >= 1: + ibmax = '--bmax %s' % options.ibmax + else: + ibmax = '' + if options.ibmaxdivn != 'None' and int( options.ibmaxdivn ) >= 0: + ibmaxdivn = '--bmaxdivn %s' % options.ibmaxdivn + else: + ibmaxdivn = '' + if options.idcv != 'None' and int( options.idcv ) > 0: + idcv = '--dcv %s' % options.idcv + else: + idcv = '' + if options.inodc == 'nodc': + inodc = '--nodc' + else: + inodc = '' + if options.inoref == 'noref': + inoref = '--noref' + else: + inoref = '' + if options.iftab != 'None' and int( options.iftab ) >= 0: + iftab = '--ftabchars %s' % options.iftab + else: + iftab = '' + if options.intoa == 'yes': + intoa = '--ntoa' + else: + intoa = '' + if options.iendian == 'big': + iendian = '--big' + else: + iendian = '--little' + if int( options.iseed ) > 0: + iseed = '--seed %s' % options.iseed + else: + iseed = '' + if int( options.icutoff ) > 0: + icutoff = '--cutoff %s' % options.icutoff + else: + icutoff = '' + indexing_cmds = '%s %s %s %s %s %s %s --offrate %s %s %s %s %s %s %s' % \ + ( iauto_b, ipacked, ibmax, ibmaxdivn, idcv, inodc, + inoref, options.ioffrate, iftab, intoa, iendian, + iseed, icutoff, colorspace ) except ValueError: indexing_cmds = '' try: - shutil.copy(options.ref, tmp_index_dir) - except Exception, erf: - stop_err('Error creating temp directory for indexing purposes\n' + str(erf)) - options.ref = os.path.join(tmp_index_dir,os.path.split(options.ref)[1]) - cmd1 = 'bowtie-build %s -f %s %s 2> /dev/null' % (indexing_cmds, options.ref, options.ref) + shutil.copy( options.ref, tmp_index_dir ) + except Exception, e: + stop_err( 'Error creating temp directory for indexing purposes\n' + str( e ) ) + options.ref = os.path.join( tmp_index_dir, os.path.split( options.ref )[1] ) + cmd1 = 'bowtie-build %s -f %s %s 2> /dev/null' % ( indexing_cmds, options.ref, options.ref ) try: - os.chdir(tmp_index_dir) - os.system(cmd1) - except Exception, erf: - stop_err('Error indexing reference sequence\n' + str(erf)) + os.chdir( tmp_index_dir ) + os.system( cmd1 ) + except Exception, e: + stop_err( 'Error indexing reference sequence\n' + str( e ) ) # set up aligning and generate aligning command options # automatically set threads in both cases - if options.params == 'pre_set': - aligning_cmds = '-p %s -S' % options.threads + if options.suppressHeader == 'true': + suppressHeader = '--sam-nohead' + else: + suppressHeader = '' + if options.params == 'csPreSet' or options.params == 'cpPreSet' or \ + options.params == 'xsPreSet' or options.params == 'xpPreSet': + aligning_cmds = '-p %s -S %s -q %s ' % ( options.threads, suppressHeader, colorspace ) else: try: - aligning_cmds = '%s %s %s %s %s %s %s %s %s %s %s %s %s %s ' \ - '%s %s %s %s %s %s %s %s %s %s -p %s -S' % \ - (('','-s %s'%options.skip)[options.skip!='None'], - ('','-u %s'%options.alignLimit)[int(options.alignLimit)>0], - ('','-5 %s'%options.trimH)[int(options.trimH)>=0], - ('','-3 %s'%options.trimL)[int(options.trimL)>=0], - ('','-n %s'%options.mismatchSeed)[options.mismatchSeed=='0' or options.mismatchSeed=='1' or options.mismatchSeed=='2' or options.mismatchSeed=='3'], - ('','-e %s'%options.mismatchQual)[int(options.mismatchQual)>=0], - ('','-l %s'%options.seedLen)[int(options.seedLen)>=5], - ('','--nomaqround')[options.rounding=='noRound'], - ('','-v %s'%options.maqSoapAlign)[options.maqSoapAlign!='-1'], - ('','-I %s'%options.minInsert)[options.minInsert!='None'], - ('','-X %s'%options.maxInsert)[options.maxInsert!='None'], - ('','--%s'%options.mateOrient)[options.mateOrient!='None'], - ('','--pairtries %s'%options.maxAlignAttempt)[options.maxAlignAttempt!='None' and int(options.maxAlignAttempt)>=0], - ('','--nofw')[options.forwardAlign=='noForward'], - ('','--norc')[options.reverseAlign=='noReverse'], - ('','--maxbts %s'%options.maxBacktracks)[options.maxBacktracks!='None' and (options.mismatchSeed=='2' or options.mismatchSeed=='3')], - ('','-y')[options.tryHard=='doTryHard'], - ('','-k %s'%options.valAlign)[options.valAlign!='None' and int(options.valAlign)>=0], - ('','-a')[options.allValAligns=='doAllValAligns' and int(options.allValAligns)>=0], - ('','-m %s'%options.suppressAlign)[int(options.suppressAlign)>=0], - ('','--best')[options.best=='doBest'], - ('','--strata')[options.strata=='doStrata'], - ('','-o %s'%options.offrate)[int(options.offrate)>=0], - ('','--seed %s'%options.seed)[int(options.seed)>=0], - options.threads) - except ValueError, erf: - stop_err('Something is wrong with the alignment parameters and the alignment could not be run\n' + str(erf)) + if options.skip != 'None' and int( options.skip ) > 0: + skip = '-s %s' % options.skip + else: + skip = '' + if int( options.alignLimit ) >= 0: + alignLimit = '-u %s' % options.alignLimit + else: + alignLimit = '' + if int( options.trimH ) > 0: + trimH = '-5 %s' % options.trimH + else: + trimH = '' + if int( options.trimL ) > 0: + trimL = '-3 %s' % options.trimL + else: + trimL = '' + if options.mismatchSeed == '0' or options.mismatchSeed == '1' or options.mismatchSeed == '2' or options.mismatchSeed == '3': + mismatchSeed = '-n %s' % options.mismatchSeed + else: + mismatchSeed = '' + if int( options.mismatchQual ) >= 0: + mismatchQual = '-e %s' % options.mismatchQual + else: + mismatchQual = '' + if int( options.seedLen ) >= 5: + seedLen = '-l %s' % options.seedLen + else: + seedLen = '' + if options.rounding == 'noRound': + rounding = '--nomaqround' + else: + rounding = '' + if options.maqSoapAlign != '-1': + maqSoapAlign = '-v %s' % options.maqSoapAlign + else: + maqSoapAlign = '' + if options.minInsert != 'None' and int( options.minInsert ) > 0: + minInsert = '-I %s' % options.minInsert + else: + minInsert = '' + if options.maxInsert != 'None' and int( options.maxInsert ) > 0: + maxInsert = '-X %s' % options.maxInsert + else: + maxInsert = '' + if options.mateOrient != 'None': + mateOrient = '--%s' % options.mateOrient + else: + mateOrient = '' + if options.maxAlignAttempt != 'None' and int( options.maxAlignAttempt ) >= 0: + maxAlignAttempt = '--pairtries %s' % options.maxAlignAttempt + else: + maxAlignAttempt = '' + if options.forwardAlign == 'noForward': + forwardAlign = '--nofw' + else: + forwardAlign = '' + if options.reverseAlign == 'noReverse': + reverseAlign = '--norc' + else: + reverseAlign = '' + if options.maxBacktracks != 'None' and int( options.maxBacktracks ) > 0 and \ + ( options.mismatchSeed == '2' or options.mismatchSeed == '3' ): + maxBacktracks = '--maxbts %s' % options.maxBacktracks + else: + maxBacktracks = '' + if options.tryHard == 'doTryHard': + tryHard = '-y' + else: + tryHard = '' + if options.valAlign != 'None' and int( options.valAlign ) >= 0: + valAlign = '-k %s' % options.valAlign + else: + valAlign = '' + if options.allValAligns == 'doAllValAligns': + allValAligns = '-a' + else: + allValAligns = '' + if options.suppressAlign != 'None' and int( options.suppressAlign ) >= 0: + suppressAlign = '-m %s' % options.suppressAlign + else: + suppressAlign = '' + if options.best == 'csDoBest' or options.best == 'cpDoBest' or \ + options.best == 'xsDoBest' or options.best == 'xpDoBest': + best = '--best' + else: + best = '' + if options.strata == 'doStrata': + strata = '--strata' + else: + strata = '' + if options.offrate != 'None' and int( options.offrate ) >= 0: + offrate = '-o %s' % options.offrate + else: + offrate = '' + if options.seed != 'None' and int( options.seed ) >= 0: + seed = '--seed %s' % options.seed + else: + seed = '' + if options.snpphred != 'None' and int( options.snpphred ) >= 0: + snpphred = '--snpphred %s' % options.snpphred + else: + snpphred = '' + if options.snpfrac != 'None' and float( options.snpfrac ) >= 0: + snpfrac = '--snpfrac %s' % options.snpfrac + else: + snpfrac = '' + if options.keepends != 'None' and options.keepends == 'doKeepends': + keepends = '--col-keepends' + else: + keepends = '' + aligning_cmds = '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s ' \ + '%s %s %s %s %s %s %s %s %s %s %s -p %s -S %s -q' % \ + ( skip, alignLimit, trimH, trimL, mismatchSeed, mismatchQual, + seedLen, rounding, maqSoapAlign, minInsert, maxInsert, + mateOrient, maxAlignAttempt, forwardAlign, reverseAlign, + maxBacktracks, tryHard, valAlign, allValAligns, suppressAlign, + best, strata, offrate, seed, colorspace, snpphred, snpfrac, + keepends, options.threads, suppressHeader ) + except ValueError, e: + stop_err( 'Something is wrong with the alignment parameters and the alignment could not be run\n' + str( e ) ) # prepare actual aligning commands - if options.paired == 'paired': - cmd2 = 'bowtie %s %s -1 %s -2 %s > %s 2> /dev/null' % (aligning_cmds, options.ref, options.input1, options.input2, options.output) + if options.paired == 'cPaired' or options.paired == 'xPaired': + cmd2 = 'bowtie %s %s -1 %s -2 %s > %s 2> /dev/null' % ( aligning_cmds, options.ref, options.input1, options.input2, options.output ) else: - cmd2 = 'bowtie %s %s %s > %s 2> /dev/null' % (aligning_cmds, options.ref, options.input1, options.output) + cmd2 = 'bowtie %s %s %s > %s 2> /dev/null' % ( aligning_cmds, options.ref, options.input1, options.output ) # align try: - os.system(cmd2) - except Exception, erf: - stop_err("Error aligning sequence\n" + str(erf)) - # remove header if necessary - if options.suppressHeader == 'true': - tmp_out = tempfile.NamedTemporaryFile() - cmd3 = 'cp %s %s' % (options.output, tmp_out.name) - try: - os.system(cmd3) - except Exception, erf: - stop_err("Error copying output file before removing headers\n" + str(erf)) - output = file(tmp_out.name, 'r') - fout = file(options.output, 'w') - header = True - line = output.readline() - while line.strip() != '': - if header: - if line.startswith('@HD') or line.startswith('@SQ') or line.startswith('@RG') or line.startswith('@PG') or line.startswith('@CO'): - pass - else: - header = False - fout.write(line) - else: - fout.write(line) - line = output.readline() - fout.close() - tmp_out.close() + os.system( cmd2 ) + except Exception, e: + stop_err( 'Error aligning sequence\n' + str( e ) ) # clean up temp dir - if os.path.exists(tmp_index_dir): - shutil.rmtree(tmp_index_dir) + if os.path.exists( tmp_index_dir ): + shutil.rmtree( tmp_index_dir ) if __name__=="__main__": __main__() diff --git a/tools/sr_mapping/bowtie_wrapper.xml b/tools/sr_mapping/bowtie_wrapper.xml index c74346e1ad6..9dfc1176965 100644 --- a/tools/sr_mapping/bowtie_wrapper.xml +++ b/tools/sr_mapping/bowtie_wrapper.xml @@ -1,326 +1,780 @@ - + - bowtie_wrapper.py - --threads="4" - --input1=$singlePaired.input1 - #if $singlePaired.sPaired == "paired": - --input2=$singlePaired.input2 - #else: - --input2="None" - #end if - --output=$output - --paired=$singlePaired.sPaired - --genomeSource=$refGenomeSource.genomeSource - #if $refGenomeSource.genomeSource == "history": - --ref=$refGenomeSource.ownFile - #else: - --ref=$refGenomeSource.indices.value - #end if - --params=$singlePaired.params.settings_type - #if $singlePaired.params.settings_type == "full": - --skip=$singlePaired.params.skip - --alignLimit=$singlePaired.params.alignLimit - --trimH=$singlePaired.params.trimH - --trimL=$singlePaired.params.trimL - --mismatchSeed=$singlePaired.params.mismatchSeed - --mismatchQual=$singlePaired.params.mismatchQual - --seedLen=$singlePaired.params.seedLen - --rounding=$singlePaired.params.rounding - --maqSoapAlign=$singlePaired.params.maqSoapAlign - --tryHard=$singlePaired.params.tryHard - --valAlign=$singlePaired.params.valAlign - --allValAligns=$singlePaired.params.allValAligns - --suppressAlign=$singlePaired.params.suppressAlign - --offrate=$singlePaired.params.offrate - --seed=$singlePaired.params.seed - --best=$singlePaired.params.bestOption.best - #if $singlePaired.params.bestOption.best == "doBest": - --maxBacktracks=$singlePaired.params.bestOption.maxBacktracks - --strata=$singlePaired.params.bestOption.strata - #else: - --maxBacktracks="None" - --strata="None" - #end if - #if $singlePaired.sPaired == "single": - --minInsert="None" - --maxInsert="None" - --mateOrient="None" - --maxAlignAttempt="None" - --forwardAlign="None" - --reverseAlign="None" - #else: - --minInsert=$singlePaired.params.minInsert - --maxInsert=$singlePaired.params.maxInsert - --mateOrient=$singlePaired.params.mateOrient - --maxAlignAttempt=$singlePaired.params.maxAlignAttempt - --forwardAlign=$singlePaired.params.forwardAlign - --reverseAlign=$singlePaired.params.reverseAlign - #end if - #else - --skip="None" - --alignLimit="None" - --trimH="None" - --trimL="None" - --mismatchSeed="None" - --mismatchQual="None" - --seedLen="None" - --rounding="None" - --maqSoapAlign="None" - --tryHard="None" - --valAlign="None" - --allValAligns="None" - --suppressAlign="None" - --best="None" - --maxBacktracks="None" - --strata="None" - --minInsert="None" - --maxInsert="None" - --mateOrient="None" - --maxAlignAttempt="None" - --forwardAlign="None" - --reverseAlign="None" - --offrate="None" - --seed="None" - #end if - #if $refGenomeSource.genomeSource == "history": - --dbkey=$dbkey - #else: - --dbkey="None" - #end if - #if $refGenomeSource.genomeSource == "history": - --indexSettings=$refGenomeSource.indexParams.index_settings - #else: - --indexSettings="None" - #end if - #if $refGenomeSource.genomeSource == "history" and $refGenomeSource.indexParams.index_settings == "index_full": - --iauto_b=$refGenomeSource.indexParams.auto_behavior.auto_b - #if $refGenomeSource.indexParams.auto_behavior.auto_b == "set": - --ipacked=$refGenomeSource.indexParams.auto_behavior.packed - --ibmax=$refGenomeSource.indexParams.auto_behavior.bmax - --ibmaxdivn=$refGenomeSource.indexParams.auto_behavior.bmaxdivn - --idcv=$refGenomeSource.indexParams.auto_behavior.dcv - #else: - --ipacked="None" - --ibmax="None" - --ibmaxdivn="None" - --idcv="None" - #end if - --inodc=$refGenomeSource.indexParams.nodc - --inoref=$refGenomeSource.indexParams.noref - --ioffrate=$refGenomeSource.indexParams.offrate - --iftab=$refGenomeSource.indexParams.ftab - --intoa=$refGenomeSource.indexParams.ntoa - --iendian=$refGenomeSource.indexParams.endian - --iseed=$refGenomeSource.indexParams.seed - --icutoff=$refGenomeSource.indexParams.cutoff - #else: - --iauto_b="None" - --ipacked="None" - --ibmax="None" - --ibmaxdivn="None" - --idcv="None" - --inodc="None" - --inoref="None" - --ioffrate="None" - --iftab="None" - --intoa="None" - --iendian="None" - --iseed="None" - --icutoff="None" - #end if - --suppressHeader=$suppressHeader + bowtie_wrapper.py --threads="4" --output=$output --suppressHeader=$suppressHeader --dataType=$solidOrSolexa.dataType +#if $solidOrSolexa.dataType == "solid": + --genomeSource=$solidOrSolexa.cRefGenomeSource.cGenomeSource + #if $solidOrSolexa.cRefGenomeSource.cGenomeSource == "cIndexed": + --ref=$solidOrSolexa.cRefGenomeSource.cIndex.value + --dbkey="None" + --indexSettings="None" + --iauto_b="None" + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + --inodc="None" + --inoref="None" + --ioffrate="None" + --iftab="None" + --intoa="None" + --iendian="None" + --iseed="None" + --icutoff="None" + #else: + --ref=$solidOrSolexa.cRefGenomeSource.cOwnFile + --dbkey=$dbkey + --indexSettings=$solidOrSolexa.cRefGenomeSource.cIndexParams.cIndexSettings + #if $solidOrSolexa.cRefGenomeSource.cIndexParams.cIndexSettings == "cIndexFull": + --iauto_b=$solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cAutoB == "cSet" + #if $solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cAutoB == "cSet": + --ipacked=$solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cPacked + --ibmax=$solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cBmax + --ibmaxdivn=$solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cBmaxdivn + --idcv=$solidOrSolexa.cRefGenomeSource.cIndexParams.cAutoBehavior.cDcv + #else: + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + #end if + --inodc=$solidOrSolexa.cRefGenomeSource.cIndexParams.cNodc + --inoref=$solidOrSolexa.cRefGenomeSource.cIndexParams.cNoref + --ioffrate=$solidOrSolexa.cRefGenomeSource.cIndexParams.cOffrate + --iftab=$solidOrSolexa.cRefGenomeSource.cIndexParams.cFtab + --intoa=$solidOrSolexa.cRefGenomeSource.cIndexParams.cNtoa + --iendian=$solidOrSolexa.cRefGenomeSource.cIndexParams.cEndian + --iseed=$solidOrSolexa.cRefGenomeSource.cIndexParams.cSeed + --icutoff=$solidOrSolexa.cRefGenomeSource.cIndexParams.cCutoff + #else: + --iauto_b="None" + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + --inodc="None" + --inoref="None" + --ioffrate="None" + --iftab="None" + --intoa="None" + --iendian="None" + --iseed="None" + --icutoff="None" + #end if + #end if + --paired=$solidOrSolexa.cSinglePaired.cSPaired + #if $solidOrSolexa.cSinglePaired.cSPaired == "cSingle": + --input1=$solidOrSolexa.cSinglePaired.csInput1 + --input2="None" + --params=$solidOrSolexa.cSinglePaired.csParams.csSettingsType + #if $solidOrSolexa.cSinglePaired.csParams.csSettingsType == "csFull": + --skip=$solidOrSolexa.cSinglePaired.csParams.csSkip + --alignLimit=$solidOrSolexa.cSinglePaired.csParams.csAlignLimit + --trimH=$solidOrSolexa.cSinglePaired.csParams.csTrimH + --trimL=$solidOrSolexa.cSinglePaired.csParams.csTrimL + --mismatchSeed=$solidOrSolexa.cSinglePaired.csParams.csMismatchSeed + --mismatchQual=$solidOrSolexa.cSinglePaired.csParams.csMismatchQual + --seedLen=$solidOrSolexa.cSinglePaired.csParams.csSeedLen + --rounding=$solidOrSolexa.cSinglePaired.csParams.csRounding + --maqSoapAlign=$solidOrSolexa.cSinglePaired.csParams.csMaqSoapAlign + --tryHard=$solidOrSolexa.cSinglePaired.csParams.csTryHard + --valAlign=$solidOrSolexa.cSinglePaired.csParams.csValAlign + --allValAligns=$solidOrSolexa.cSinglePaired.csParams.csAllValAligns + --suppressAlign=$solidOrSolexa.cSinglePaired.csParams.csSuppressAlign + --best=$solidOrSolexa.cSinglePaired.csParams.csBestOption.csBest + #if $solidOrSolexa.cSinglePaired.csParams.csBestOption.csBest == "csDoBest": + --maxBacktracks=$solidOrSolexa.cSinglePaired.csParams.csBestOption.csdMaxBacktracks + --strata=$solidOrSolexa.cSinglePaired.csParams.csBestOption.csdStrata + #else: + --maxBacktracks=$solidOrSolexa.cSinglePaired.csParams.csBestOption.csnMaxBacktracks + --strata="None" + #end if + --offrate=$solidOrSolexa.cSinglePaired.csParams.csOffrate + --seed=$solidOrSolexa.cSinglePaired.csParams.csSeed + --snpphred=$solidOrSolexa.cSinglePaired.csParams.csSnpphred + --snpfrac=$solidOrSolexa.cSinglePaired.csParams.csSnpfrac + --keepends=$solidOrSolexa.cSinglePaired.csParams.csKeepends + #else: + --skip="None" + --alignLimit="None" + --trimH="None" + --trimL="None" + --mismatchSeed="None" + --mismatchQual="None" + --seedLen="None" + --rounding="None" + --maqSoapAlign="None" + --tryHard="None" + --valAlign="None" + --allValAligns="None" + --suppressAlign="None" + --best="None" + --maxBacktracks="None" + --strata="None" + --offrate="None" + --seed="None" + --snpphred="None" + --snpfrac="None" + --keepends="None" + #end if + --minInsert="None" + --maxInsert="None" + --mateOrient="None" + --maxAlignAttempt="None" + --forwardAlign="None" + --reverseAlign="None" + #else: + --input1=$solidOrSolexa.cSinglePaired.cpInput1 + --input2=$solidOrSolexa.cSinglePaired.cpInput2 + --params=$solidOrSolexa.cSinglePaired.cpParams.cpSettingsType + #if $solidOrSolexa.cSinglePaired.cpParams.cpSettingsType == "cpFull": + --skip=$solidOrSolexa.cSinglePaired.cpParams.cpSkip + --alignLimit=$solidOrSolexa.cSinglePaired.cpParams.cpAlignLimit + --trimH=$solidOrSolexa.cSinglePaired.cpParams.cpTrimH + --trimL=$solidOrSolexa.cSinglePaired.cpParams.cpTrimL + --mismatchSeed=$solidOrSolexa.cSinglePaired.cpParams.cpMismatchSeed + --mismatchQual=$solidOrSolexa.cSinglePaired.cpParams.cpMismatchQual + --seedLen=$solidOrSolexa.cSinglePaired.cpParams.cpSeedLen + --rounding=$solidOrSolexa.cSinglePaired.cpParams.cpRounding + --maqSoapAlign=$solidOrSolexa.cSinglePaired.cpParams.cpMaqSoapAlign + --minInsert=$solidOrSolexa.cSinglePaired.cpParams.cpMinInsert + --maxInsert=$solidOrSolexa.cSinglePaired.cpParams.cpMaxInsert + --mateOrient=$solidOrSolexa.cSinglePaired.cpParams.cpMateOrient + --maxAlignAttempt=$solidOrSolexa.cSinglePaired.cpParams.cpMaxAlignAttempt + --forwardAlign=$solidOrSolexa.cSinglePaired.cpParams.cpForwardAlign + --reverseAlign=$solidOrSolexa.cSinglePaired.cpParams.cpReverseAlign + --tryHard=$solidOrSolexa.cSinglePaired.cpParams.cpTryHard + --valAlign=$solidOrSolexa.cSinglePaired.cpParams.cpValAlign + --allValAligns=$solidOrSolexa.cSinglePaired.cpParams.cpAllValAligns + --suppressAlign=$solidOrSolexa.cSinglePaired.cpParams.cpSuppressAlign + --best=$solidOrSolexa.cSinglePaired.cpParams.cpBestOption.cpBest + #if $solidOrSolexa.cSinglePaired.cpParams.cpBestOption.cpBest == "cpDoBest": + --maxBacktracks=$solidOrSolexa.cSinglePaired.cpParams.cpBestOption.cpdMaxBacktracks + --strata=$solidOrSolexa.cSinglePaired.cpParams.cpBestOption.cpdStrata + #else: + --maxBacktracks=$solidOrSolexa.cSinglePaired.cpParams.cpBestOption.cpnMaxBacktracks + --strata="None" + #end if + --offrate=$solidOrSolexa.cSinglePaired.cpParams.cpOffrate + --seed=$solidOrSolexa.cSinglePaired.cpParams.cpSeed + --snpphred=$solidOrSolexa.cSinglePaired.cpParams.cpSnpphred + --snpfrac=$solidOrSolexa.cSinglePaired.cpParams.cpSnpfrac + --keepends=$solidOrSolexa.cSinglePaired.cpParams.cpKeepends + #else: + --skip="None" + --alignLimit="None" + --trimH="None" + --trimL="None" + --mismatchSeed="None" + --mismatchQual="None" + --seedLen="None" + --rounding="None" + --maqSoapAlign="None" + --tryHard="None" + --valAlign="None" + --allValAligns="None" + --suppressAlign="None" + --best="None" + --maxBacktracks="None" + --strata="None" + --offrate="None" + --seed="None" + --snpphred="None" + --snpfrac="None" + --keepends="None" + --minInsert="None" + --maxInsert="None" + --mateOrient="None" + --maxAlignAttempt="None" + --forwardAlign="None" + --reverseAlign="None" + #end if + #end if +#else: + --genomeSource=$solidOrSolexa.xRefGenomeSource.xGenomeSource + #if $solidOrSolexa.xRefGenomeSource.xGenomeSource == "xIndexed": + --ref=$solidOrSolexa.xRefGenomeSource.xIndex.value + --dbkey="None" + --indexSettings="None" + --iauto_b="None" + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + --inodc="None" + --inoref="None" + --ioffrate="None" + --iftab="None" + --intoa="None" + --iendian="None" + --iseed="None" + --icutoff="None" + #else: + --ref=$solidOrSolexa.xRefGenomeSource.xOwnFile + --dbkey=$dbkey + --indexSettings=$solidOrSolexa.xRefGenomeSource.xIndexParams.xIndexSettings + #if $solidOrSolexa.xRefGenomeSource.xIndexParams.xIndexSettings == "xIndexFull": + --iauto_b=$solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xAutoB == "xSet" + #if $solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xAutoB == "xSet": + --ipacked=$solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xPacked + --ibmax=$solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xBmax + --ibmaxdivn=$solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xBmaxdivn + --idcv=$solidOrSolexa.xRefGenomeSource.xIndexParams.xAutoBehavior.xDcv + #else: + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + #end if + --inodc=$solidOrSolexa.xRefGenomeSource.xIndexParams.xNodc + --inoref=$solidOrSolexa.xRefGenomeSource.xIndexParams.xNoref + --ioffrate=$solidOrSolexa.xRefGenomeSource.xIndexParams.xOffrate + --iftab=$solidOrSolexa.xRefGenomeSource.xIndexParams.xFtab + --intoa=$solidOrSolexa.xRefGenomeSource.xIndexParams.xNtoa + --iendian=$solidOrSolexa.xRefGenomeSource.xIndexParams.xEndian + --iseed=$solidOrSolexa.xRefGenomeSource.xIndexParams.xSeed + --icutoff=$solidOrSolexa.xRefGenomeSource.xIndexParams.xCutoff + #else: + --iauto_b="None" + --ipacked="None" + --ibmax="None" + --ibmaxdivn="None" + --idcv="None" + --inodc="None" + --inoref="None" + --ioffrate="None" + --iftab="None" + --intoa="None" + --iendian="None" + --iseed="None" + --icutoff="None" + #end if + #end if + --paired=$solidOrSolexa.xSinglePaired.xSPaired + #if $solidOrSolexa.xSinglePaired.xSPaired == "xSingle": + --input1=$solidOrSolexa.xSinglePaired.xsInput1 + --input2="None" + --params=$solidOrSolexa.xSinglePaired.xsParams.xsSettingsType + #if $solidOrSolexa.xSinglePaired.xsParams.xsSettingsType == "xsFull": + --skip=$solidOrSolexa.xSinglePaired.xsParams.xsSkip + --alignLimit=$solidOrSolexa.xSinglePaired.xsParams.xsAlignLimit + --trimH=$solidOrSolexa.xSinglePaired.xsParams.xsTrimH + --trimL=$solidOrSolexa.xSinglePaired.xsParams.xsTrimL + --mismatchSeed=$solidOrSolexa.xSinglePaired.xsParams.xsMismatchSeed + --mismatchQual=$solidOrSolexa.xSinglePaired.xsParams.xsMismatchQual + --seedLen=$solidOrSolexa.xSinglePaired.xsParams.xsSeedLen + --rounding=$solidOrSolexa.xSinglePaired.xsParams.xsRounding + --maqSoapAlign=$solidOrSolexa.xSinglePaired.xsParams.xsMaqSoapAlign + --tryHard=$solidOrSolexa.xSinglePaired.xsParams.xsTryHard + --valAlign=$solidOrSolexa.xSinglePaired.xsParams.xsValAlign + --allValAligns=$solidOrSolexa.xSinglePaired.xsParams.xsAllValAligns + --suppressAlign=$solidOrSolexa.xSinglePaired.xsParams.xsSuppressAlign + --best=$solidOrSolexa.xSinglePaired.xsParams.xsBestOption.xsBest + #if $solidOrSolexa.xSinglePaired.xsParams.xsBestOption.xsBest == "xsDoBest": + --maxBacktracks=$solidOrSolexa.xSinglePaired.xsParams.xsBestOption.xsdMaxBacktracks + --strata=$solidOrSolexa.xSinglePaired.xsParams.xsBestOption.xsdStrata + #else: + --maxBacktracks=$solidOrSolexa.xSinglePaired.xsParams.xsBestOption.xsnMaxBacktracks + --strata="None" + #end if + --offrate=$solidOrSolexa.xSinglePaired.xsParams.xsOffrate + --seed=$solidOrSolexa.xSinglePaired.xsParams.xsSeed + #else: + --skip="None" + --alignLimit="None" + --trimH="None" + --trimL="None" + --mismatchSeed="None" + --mismatchQual="None" + --seedLen="None" + --rounding="None" + --maqSoapAlign="None" + --tryHard="None" + --valAlign="None" + --allValAligns="None" + --suppressAlign="None" + --best="None" + --maxBacktracks="None" + --strata="None" + --offrate="None" + --seed="None" + #end if + --snpphred="None" + --snpfrac="None" + --keepends="None" + --minInsert="None" + --maxInsert="None" + --mateOrient="None" + --maxAlignAttempt="None" + --forwardAlign="None" + --reverseAlign="None" + #else: + --input1=$solidOrSolexa.xSinglePaired.xpInput1 + --input2=$solidOrSolexa.xSinglePaired.xpInput2 + --params=$solidOrSolexa.xSinglePaired.xpParams.xpSettingsType + #if $solidOrSolexa.xSinglePaired.xpParams.xpSettingsType == "xpFull": + --skip=$solidOrSolexa.xSinglePaired.xpParams.xpSkip + --alignLimit=$solidOrSolexa.xSinglePaired.xpParams.xpAlignLimit + --trimH=$solidOrSolexa.xSinglePaired.xpParams.xpTrimH + --trimL=$solidOrSolexa.xSinglePaired.xpParams.xpTrimL + --mismatchSeed=$solidOrSolexa.xSinglePaired.xpParams.xpMismatchSeed + --mismatchQual=$solidOrSolexa.xSinglePaired.xpParams.xpMismatchQual + --seedLen=$solidOrSolexa.xSinglePaired.xpParams.xpSeedLen + --rounding=$solidOrSolexa.xSinglePaired.xpParams.xpRounding + --maqSoapAlign=$solidOrSolexa.xSinglePaired.xpParams.xpMaqSoapAlign + --minInsert=$solidOrSolexa.xSinglePaired.xpParams.xpMinInsert + --maxInsert=$solidOrSolexa.xSinglePaired.xpParams.xpMaxInsert + --mateOrient=$solidOrSolexa.xSinglePaired.xpParams.xpMateOrient + --maxAlignAttempt=$solidOrSolexa.xSinglePaired.xpParams.xpMaxAlignAttempt + --forwardAlign=$solidOrSolexa.xSinglePaired.xpParams.xpForwardAlign + --reverseAlign=$solidOrSolexa.xSinglePaired.xpParams.xpReverseAlign + --tryHard=$solidOrSolexa.xSinglePaired.xpParams.xpTryHard + --valAlign=$solidOrSolexa.xSinglePaired.xpParams.xpValAlign + --allValAligns=$solidOrSolexa.xSinglePaired.xpParams.xpAllValAligns + --suppressAlign=$solidOrSolexa.xSinglePaired.xpParams.xpSuppressAlign + --best=$solidOrSolexa.xSinglePaired.xpParams.xpBestOption.xpBest + #if $solidOrSolexa.xSinglePaired.xpParams.xpBestOption.xpBest == "xpDoBest": + --maxBacktracks=$solidOrSolexa.xSinglePaired.xpParams.xpBestOption.xpdMaxBacktracks + --strata=$solidOrSolexa.xSinglePaired.xpParams.xpBestOption.xpdStrata + #else: + --maxBacktracks=$solidOrSolexa.xSinglePaired.xpParams.xpBestOption.xpnMaxBacktracks + --strata="None" + #end if + --offrate=$solidOrSolexa.xSinglePaired.xpParams.xpOffrate + --seed=$solidOrSolexa.xSinglePaired.xpParams.xpSeed + #else: + --skip="None" + --alignLimit="None" + --trimH="None" + --trimL="None" + --mismatchSeed="None" + --mismatchQual="None" + --seedLen="None" + --rounding="None" + --maqSoapAlign="None" + --tryHard="None" + --valAlign="None" + --allValAligns="None" + --suppressAlign="None" + --best="None" + --maxBacktracks="None" + --strata="None" + --offrate="None" + --seed="None" + --minInsert="None" + --maxInsert="None" + --mateOrient="None" + --maxAlignAttempt="None" + --forwardAlign="None" + --reverseAlign="None" + #end if + --snpphred="None" + --snpfrac="None" + --keepends="None" + #end if +#end if - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -328,83 +782,257 @@ - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + **What it does** @@ -526,6 +1154,9 @@ For aligning (bowtie):: --strata Best strata. When running in best mode, report alignments that fall into the best stratum if there are ones falling into more than one. [off] -o <int> Offrate override. Override the offrate of the index with <int>. Some row markings are discarded when index read into memory. <int> must be greater than the value used to build the index (default: 5). [off] --seed <int> Random seed. Use <int> as the seed for the pseudo-random number generator. [off] + --snpphred <int> Use <int> as the SNP penalty for decoding colorspace alignments. True ratio of SNPs per base in the subject genome. [see --snpfrac] + --snpfrac <dec> Use <dec> as the estimated ratio of SNPs per base when decoding colorspace alignments. [0.001] + --col-keepends Keep the extreme-end nucleotides and qualities when decoding colorspace alignments. [off] diff --git a/tools/sr_mapping/bowtie_wrapper_code.py b/tools/sr_mapping/bowtie_wrapper_code.py index c98397639af..52a2c775359 100644 --- a/tools/sr_mapping/bowtie_wrapper_code.py +++ b/tools/sr_mapping/bowtie_wrapper_code.py @@ -2,15 +2,21 @@ import os def exec_before_job(app, inp_data, out_data, param_dict, tool): try: - refFile = param_dict['refGenomeSource']['indices'].value + try: + refFile = param_dict[ 'solidOrSolexa' ][ 'cRefGenomeSource' ][ 'cIndex' ].value + except: + refFile = param_dict[ 'solidOrSolexa' ][ 'xRefGenomeSource' ][ 'xIndex' ].value except: try: - refFile = param_dict['refGenomeSource']['ownFile'].dbkey + try: + refFile = param_dict[ 'solidOrSolexa' ][ 'cRefGenomeSource' ][ 'cOwnFile' ].dbkey + except: + refFile = param_dict[ 'solidOrSolexa' ][ 'xRefGenomeSource' ][ 'xOwnFile' ].dbkey except: - out_data['output'].set_dbkey('?') + out_data[ 'output' ].set_dbkey( '?' ) return - dbkey = os.path.split(refFile)[1].split('.')[0] + dbkey = os.path.split( refFile )[1].split( '.' )[0] # deal with the one odd case - if dbkey.find('chrM') >= 0: + if dbkey.find( 'chrM' ) >= 0 or dbkey.find( 'chr_m' ) >= 0: dbkey = 'equCab2' - out_data['output'].set_dbkey(dbkey) + out_data[ 'output' ].set_dbkey(dbkey)