# HG changeset patch # User Rayan Chikhi # Date 1402954695 14400 # Node ID b2ca2d181fb47d13504a83b2607cdb998be34709 # Parent 844fa42ad305b80b17d42b7c92920d17facd6f0b fixed downsample sam in picard1106 (accept bam) diff -r 844fa42ad305 -r b2ca2d181fb4 picard_DownsampleSam.xml --- a/picard_DownsampleSam.xml Thu Feb 27 13:15:52 2014 -0500 +++ b/picard_DownsampleSam.xml Mon Jun 16 17:38:15 2014 -0400 @@ -1,30 +1,37 @@ - + Down-sample a file to retain a subset of the reads picard picard_wrapper.py - --input=$inputFile - --output=$outFile + --input "$inputFile" + --output "$outFile" --probability=$probability + --output-format $outputFormat --seed=$seed -j "\$JAVA_JAR_PATH/DownsampleSam.jar" - + + - + + + + + - + + @@ -54,4 +61,4 @@ - \ No newline at end of file + diff -r 844fa42ad305 -r b2ca2d181fb4 picard_wrapper.py --- a/picard_wrapper.py Thu Feb 27 13:15:52 2014 -0500 +++ b/picard_wrapper.py Mon Jun 16 17:38:15 2014 -0400 @@ -800,18 +800,21 @@ cl.append('OUTPUT=%s' % tempout) pic.runPic(opts.jar, cl) haveTempout = True + elif pic.picname == "DownsampleSam": cl.append('I=%s' % opts.input) - mystring = opts.output - mystringsam = mystring + ".sam" - cl.append('O=%s' % mystringsam) + output_string = opts.output + if opts.datatype == 'sam': + output_string = output_string + ".sam" + cl.append('O=%s' % output_string) if float(opts.probability) > 0: cl.append('PROBABILITY=%s' % opts.probability) if float(opts.seed) > 0: cl.append('RANDOM_SEED=%s' % opts.seed) stdouts,rval = pic.runPic(opts.jar, cl) - myoutput = mystringsam.replace(".sam", "") - os.rename(mystringsam,myoutput) + if opts.input.endswith(".sam"): + renamed_output = output_string.replace(".sam", "") + os.rename(output_string,renamed_output) elif pic.picname == 'MeanQualityByCycle': isPDF = 'MeanQualityByCycle.pdf'