Mercurial > repos > devteam > bowtie_wrappers
diff bowtie_wrapper.py @ 4:df86f29bedee draft
planemo upload commit 00a7926c285bc4a339bd7deebf40b28f39c7d947-dirty
author | devteam |
---|---|
date | Tue, 21 Jul 2015 13:04:45 -0400 |
parents | 0c7e4eadfb3c |
children | 306077e393d4 |
line wrap: on
line diff
--- a/bowtie_wrapper.py Fri Feb 21 12:40:39 2014 -0500 +++ b/bowtie_wrapper.py Tue Jul 21 13:04:45 2015 -0400 @@ -27,10 +27,10 @@ -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 + -P, --maxMismatches=P: Maximum number of mismatches for -v alignment mode -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 + -V, --allValAligns=V: Whether or not to report all valid alignments per read or pair + -v, --valAlign=v: Report up to n valid alignments per read or pair -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 @@ -59,7 +59,6 @@ -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 --do_not_build_index: Flag to specify that provided file is already indexed and to just use 'as is' @@ -101,10 +100,10 @@ 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( '-P', '--maxMismatches', dest='maxMismatches', help='Maximum number of mismatches for -v alignment mode' ) 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( '-V', '--allValAligns', dest='allValAligns', help='Whether or not to report all valid alignments per read or pair' ) + parser.add_option( '-v', '--valAlign', dest='valAlign', help='Report up to n valid alignments per read or pair' ) 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' ) @@ -133,12 +132,13 @@ 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' ) parser.add_option( '--galaxy_input_format', dest='galaxy_input_format', default="fastqsanger", help='galaxy input format' ) parser.add_option( '--do_not_build_index', dest='do_not_build_index', action="store_true", default=False, help='Flag to specify that provided file is already indexed, use as is' ) (options, args) = parser.parse_args() + if options.mismatchSeed and options.maxMismatches: + parser.error("options --mismatchSeed and --maxMismatches are mutually exclusive") stdout = '' # make temp directory for placement of indices and copy reference file there if necessary @@ -159,19 +159,19 @@ iautoB = '--noauto' else: iautoB = '' - if options. ipacked and options.ipacked == 'packed': + if options.ipacked and options.ipacked == 'packed': ipacked = '--packed' else: ipacked = '' if options.ibmax and int( options.ibmax ) >= 1: - ibmax = '--bmax %s' % options.ibmax + ibmax = '--bmax %s' % options.ibmax else: ibmax = '' if options.ibmaxdivn and int( options.ibmaxdivn ) >= 0: ibmaxdivn = '--bmaxdivn %s' % options.ibmaxdivn else: ibmaxdivn = '' - if options.idcv and int( options.idcv ) > 0: + if options.idcv and int( options.idcv ) >= 3: idcv = '--dcv %s' % options.idcv else: idcv = '' @@ -183,7 +183,7 @@ inoref = '--noref' else: inoref = '' - if options.iftab and int( options.iftab ) >= 0: + if options.iftab and int( options.iftab ) >= 1: iftab = '--ftabchars %s' % options.iftab else: iftab = '' @@ -199,14 +199,10 @@ iseed = '--seed %s' % options.iseed else: iseed = '' - if options.icutoff and 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' % \ - ( iautoB, ipacked, ibmax, ibmaxdivn, idcv, inodc, - inoref, options.ioffrate, iftab, intoa, iendian, - iseed, icutoff, colorspace ) + indexing_cmds = '%s %s %s %s %s %s %s --offrate %s %s %s %s %s %s' % \ + ( iautoB, ipacked, ibmax, ibmaxdivn, idcv, inodc, + inoref, options.ioffrate, iftab, intoa, iendian, + iseed, colorspace ) except ValueError, e: # clean up temp dir if os.path.exists( tmp_index_dir ): @@ -283,16 +279,17 @@ trimL = '-3 %s' % options.trimL else: trimL = '' - if options.maqSoapAlign != '-1' and int( options.maqSoapAlign ) >= 0: - maqSoapAlign = '-v %s' % options.maqSoapAlign + if options.maxMismatches and (options.maxMismatches == '0' or options.maxMismatches == '1' \ + or options.maxMismatches == '2' or options.maxMismatches == '3'): + maxMismatches = '-v %s' % options.maxMismatches else: - maqSoapAlign = '' + maxMismatches = '' if options.mismatchSeed and (options.mismatchSeed == '0' or options.mismatchSeed == '1' \ or options.mismatchSeed == '2' or options.mismatchSeed == '3'): mismatchSeed = '-n %s' % options.mismatchSeed else: mismatchSeed = '' - if options.mismatchQual and int( options.mismatchQual ) >= 0: + if options.mismatchQual and int( options.mismatchQual ) >= 1: mismatchQual = '-e %s' % options.mismatchQual else: mismatchQual = '' @@ -395,8 +392,8 @@ aligning_cmds = '-q %s %s -p %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 %s %s %s %s ' % \ ( maxInsert, mateOrient, options.threads, suppressHeader, - colorspace, skip, alignLimit, trimH, trimL, maqSoapAlign, - mismatchSeed, mismatchQual, seedLen, rounding, minInsert, + colorspace, skip, alignLimit, trimH, trimL, maxMismatches, + mismatchSeed, mismatchQual, seedLen, rounding, minInsert, maxAlignAttempt, forwardAlign, reverseAlign, maxBacktracks, tryHard, valAlign, allValAligns, suppressAlign, best, strata, offrate, seed, snpphred, snpfrac, keepends, @@ -466,4 +463,5 @@ stdout += 'Sequence file aligned.\n' sys.stdout.write( stdout ) -if __name__=="__main__": __main__() +if __name__ == "__main__": + __main__()