# HG changeset patch # User iuc # Date 1599074962 14400 # Node ID bf328cec6a42c8fd5de2275e8ca59646713f1cd6 # Parent b01db2684fa591f04b7a32f3b55140a5c56e88b9 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_view commit e73e642259254253f71335ed1cbd738bb06d3346" diff -r b01db2684fa5 -r bf328cec6a42 samtools_view.xml --- a/samtools_view.xml Tue Jan 21 07:40:18 2020 -0500 +++ b/samtools_view.xml Wed Sep 02 15:29:22 2020 -0400 @@ -1,4 +1,4 @@ - + - reformat, filter, or subsample SAM, BAM or CRAM macros.xml @@ -20,21 +20,19 @@ - + + + - - - - - - - + + @@ -49,10 +47,35 @@ @PREPARE_FASTA_IDX@ @PREPARE_IDX@ + ## determine the output format flag to pass to samtools view + ## -c for count mode + ## -b to produce BAM-formatted output + ## -C to produce CRAM-formatted output + ## SAM is the default ouput format + #set $fmtopt = '' + #if str($mode.output_options.reads_report_type) == 'count': + #set $fmtopt = '-c' + #else: + #if str($mode.output_options.output_format.oformat) == 'bam': + #set $fmtopt = '-b' + #elif str($mode.output_options.output_format.oformat) == 'cram': + #set $fmtopt = '-C' + #elif str($mode.output_options.output_format.oformat) == 'input': + #if $input.is_of_type('bam'): + #set $fmtopt = '-b' + #elif $input.is_of_type('cram'): + #set $fmtopt = '-C' + #else: + ## input in SAM format, make sure to keep header if present + #set $fmtopt = '-h' + #end if + #end if + #end if + #if str($mode.outtype) == 'header': ## call samtools view and be done samtools view - -H ${mode.output_options.output_format.fmtopt} -o outfile + -H $fmtopt -o outfile @REF_DATA@ infile #else: @@ -130,11 +153,11 @@ ## not dealing with all of the reads in the indexed ## file. We have to do an extra pass over the input to ## count the reads to subsample. - sample_fragment=`samtools view -c $std_filters infile $reg_filters | awk '{s=\$1} END {frac=${mode.subsample_config.subsampling_mode.target}/s; print(frac < 1 ? $seed+frac : ".0")}'` && + sample_fragment=`samtools view -c $std_filters infile $reg_filters | awk '{s=\$1} END {frac=s/${mode.subsample_config.subsampling_mode.target}; print(frac > 1 ? $seed+1/frac : ".0")}'` && #else: ## We can get the count of reads to subsample using ## an inexpensive call to idxstats. - sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=${mode.subsample_config.subsampling_mode.target}/s; print(frac < 1 ? $seed+frac : ".0")}'` && + sample_fragment=`samtools idxstats infile | awk '{s+=\$4+\$3} END {frac=s/${mode.subsample_config.subsampling_mode.target}; print(frac > 1 ? $seed+1/frac : ".0")}'` && #end if #end if #end if @@ -142,12 +165,7 @@ ## call samtools view samtools view -@ \$addthreads - - #if str($mode.output_options.reads_report_type) == 'count': - -c - #else: - ${mode.output_options.output_format.fmtopt} - #end if + $fmtopt ## filter options (except regions filter, which is the last parameter) $std_filters @@ -304,7 +322,7 @@ - + @@ -390,7 +408,7 @@ - + mode['outtype'] != 'header' and mode['output_options']['reads_report_type'] == 'count' @@ -416,82 +434,88 @@ - + + - - - -
- - - -
- - - - - -
+ - +
- - - - - - - - - - + + + + + + + + + - + + - -
- - - -
- +
- - - - - + + + +
- + + + + + + + + + + - -
- - - - -
- +
- - - + + + + +
+ + + + + + + + + + + + + + + + + - + + + + + @@ -529,14 +553,104 @@ - + + + + + + + + + + + + + + - + + + +
+ + + +
+ + + + + +
- + +
+ + + + +
+ + + +
+ + + + + +
+ + + + + +
+ + + + +
+ + + +
+ + + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + +
@@ -582,27 +696,7 @@ - - - - -
- - - -
- - - - - -
- - - - - -
+ @@ -616,7 +710,7 @@ - + @@ -634,13 +728,51 @@ - + + + + + +
+ + + + +
+ + + + + +
+ +
+ + + + + +
+ + + + +
+ + + + + +
+ +
+ @@ -653,7 +785,7 @@ - + @@ -672,7 +804,7 @@ - + @@ -691,7 +823,7 @@ - + @@ -710,7 +842,7 @@ - + @@ -730,7 +862,7 @@ - + diff -r b01db2684fa5 -r bf328cec6a42 test-data/no_reads.bam Binary file test-data/no_reads.bam has changed diff -r b01db2684fa5 -r bf328cec6a42 test-data/no_reads.sam --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/no_reads.sam Wed Sep 02 15:29:22 2020 -0400 @@ -0,0 +1,5 @@ +@HD VN:1.4 SO:unsorted +@SQ SN:CHROMOSOME_I LN:100 +@RG ID:UNKNOWN SM:UNKNOWN +@PG ID:bowtie2 PN:bowtie2 VN:2.0.0-beta5 +@PG ID:0 CL:aaaaa/aaa/aaaaa/aaaaaa/aaaaaaaaa/aaa/iuc/package_aaaaaaaaa_x_y/aaaaaaaaaaaa/bin/aaaaaaaaaaaaaaaaa aaaaaaaaaa /aaaa/aaaaa/aaa/aaaaaaaaaaaaaaaaaaa/tools/aaaaaaaaa/test-data/test.cram aa /aaaa/aaaaa/aaa/aaaaaaaaaaaaaaaaaaa/tools/aaaaaaaaa/test-data/test.fa -O test PN:samtools VN:1.2