1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/b387de5c0439/ changeset: r5407:b387de5c0439 user: dan date: 2011-04-18 22:41:51 summary: Enhance BAM to SAM tool to optionally output headers. affected #: 2 files (759 bytes) --- a/tools/samtools/bam_to_sam.py Mon Apr 18 14:35:14 2011 -0400 +++ b/tools/samtools/bam_to_sam.py Mon Apr 18 16:41:51 2011 -0400 @@ -21,6 +21,7 @@ parser = optparse.OptionParser() parser.add_option( '', '--input1', dest='input1', help='The input SAM dataset' ) parser.add_option( '', '--output1', dest='output1', help='The output BAM dataset' ) + parser.add_option( '', '--header', dest='header', action='store_true', default=False, help='Write SAM Header' ) ( options, args ) = parser.parse_args() # output version # of tool @@ -87,7 +88,11 @@ try: # Extract all alignments from the input BAM file to SAM format ( since no region is specified, all the alignments will be extracted ). - command = 'samtools view -o %s %s' % ( options.output1, tmp_sorted_aligns_file_name ) + if options.header: + view_options = "-h" + else: + view_options = "" + command = 'samtools view %s -o %s %s' % ( view_options, options.output1, tmp_sorted_aligns_file_name ) tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name tmp_stderr = open( tmp, 'wb' ) proc = subprocess.Popen( args=command, shell=True, cwd=tmp_dir, stderr=tmp_stderr.fileno() ) --- a/tools/samtools/bam_to_sam.xml Mon Apr 18 14:35:14 2011 -0400 +++ b/tools/samtools/bam_to_sam.xml Mon Apr 18 16:41:51 2011 -0400 @@ -1,4 +1,4 @@ -<tool id="bam_to_sam" name="BAM-to-SAM" version="1.0.1"> +<tool id="bam_to_sam" name="BAM-to-SAM" version="1.0.2"><requirements><requirement type="package">samtools</requirement></requirements> @@ -7,9 +7,11 @@ bam_to_sam.py --input1=$input1 --output1=$output1 + $header </command><inputs><param name="input1" type="data" format="bam" label="BAM File to Convert" /> + <param name="header" type="boolean" truevalue="--header" falsevalue="" checked="False" label="Include header in output" /></inputs><outputs><data format="sam" name="output1" label="${tool.name} on ${on_string}: converted SAM" /> @@ -22,6 +24,7 @@ --><param name="input1" value="1.bam" ftype="bam" /><output name="output1" file="bam_to_sam_out1.sam" sorted="True" /> + <param name="header" value="" /></test><test><!-- @@ -30,6 +33,16 @@ --><param name="input1" value="3unsorted.bam" ftype="bam" /><output name="output1" file="bam_to_sam_out2.sam" sorted="True" /> + <param name="header" value="" /> + </test> + <test> + <!-- + Bam-to-Sam command: + samtools view -h -o bam_to_sam_out1.sam test-data/1.bam + --> + <param name="input1" value="1.bam" ftype="bam" /> + <output name="output1" file="bam_to_sam_out3.sam" sorted="True" /> + <param name="header" value="True" /></test></tests><help> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.