Next changeset 1:ae36fab06bc2 (2022-08-15) |
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/sam_to_bam commit 4d0362c336f67d05086298ab4980c1d922d71c6e" |
added:
macros.xml samtools_coverage.xml test-data/results_1.tabular test-data/results_2.txt test-data/results_3.txt test-data/test_1.bam test-data/test_2.bam |
b |
diff -r 000000000000 -r 90f2dd176d80 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Tue Sep 28 15:10:16 2021 +0000 |
[ |
b'@@ -0,0 +1,223 @@\n+<macros>\n+ <xml name="requirements">\n+ <requirements>\n+ <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>\n+ <yield/>\n+ </requirements>\n+ </xml>\n+ <token name="@TOOL_VERSION@">1.13</token>\n+ <token name="@PROFILE@">20.05</token>\n+ <token name="@FLAGS@"><![CDATA[\n+ #set $flags = 0\n+ #if $filter\n+ #set $flags = sum(map(int, str($filter).split(\',\')))\n+ #end if\n+ ]]></token>\n+ <token name="@PREPARE_IDX@"><![CDATA[\n+ ##prepare input and indices\n+ ln -s \'$input\' infile &&\n+ #if $input.is_of_type(\'bam\'):\n+ #if str( $input.metadata.bam_index ) != "None":\n+ ln -s \'${input.metadata.bam_index}\' infile.bai &&\n+ #else:\n+ samtools index infile infile.bai &&\n+ #end if\n+ #elif $input.is_of_type(\'cram\'):\n+ #if str( $input.metadata.cram_index ) != "None":\n+ ln -s \'${input.metadata.cram_index}\' infile.crai &&\n+ #else:\n+ samtools index infile infile.crai &&\n+ #end if\n+ #end if\n+ ]]></token>\n+ <token name="@PREPARE_IDX_MULTIPLE@"><![CDATA[\n+ ##prepare input and indices\n+ #for $i, $bam in enumerate( $input_bams ):\n+ ln -s \'$bam\' \'${i}\' &&\n+ #if $bam.is_of_type(\'bam\'):\n+ #if str( $bam.metadata.bam_index ) != "None":\n+ ln -s \'${bam.metadata.bam_index}\' \'${i}.bai\' &&\n+ #else:\n+ samtools index \'${i}\' \'${i}.bai\' &&\n+ #end if\n+ #elif $bam.is_of_type(\'cram\'):\n+ #if str( $bam.metadata.cram_index ) != "None":\n+ ln -s \'${bam.metadata.cram_index}\' \'${i}.crai\' &&\n+ #else:\n+ samtools index \'${i}\' \'${i}.crai\' &&\n+ #end if\n+ #end if\n+ #end for\n+ ]]></token>\n+ <token name="@PREPARE_FASTA_IDX@"><![CDATA[\n+ ##checks for reference data ($addref_cond.addref_select=="history" or =="cached")\n+ ##and sets the -t/-T parameters accordingly:\n+ ##- in case of history a symbolic link is used because samtools (view) will generate\n+ ## the index which might not be possible in the directory containing the fasta file\n+ ##- in case of cached the absolute path is used which allows to read the cram file\n+ ## without specifying the reference\n+ #if $addref_cond.addref_select == "history":\n+ ln -s \'${addref_cond.ref}\' reference.fa &&\n+ samtools faidx reference.fa &&\n+ #set reffa="reference.fa"\n+ #set reffai="reference.fa.fai"\n+ #elif $addref_cond.addref_select == "cached":\n+ #set reffa=str($addref_cond.ref.fields.path)\n+ #set reffai=str($addref_cond.ref.fields.path)+".fai"\n+ #else\n+ #set reffa=None\n+ #set reffai=None\n+ #end if\n+ ]]></token>\n+\n+ <xml name="optional_reference">\n+ <conditional name="addref_cond">\n+ <param name="addref_select" type="select" label="Use a reference sequence">\n+ <help>@HELP@</help>\n+ <option value="no">No</option>\n+ <option value="history">Use a genome/index from the history</option>\n+ <option value="cached">Use a built-in genome</option>\n+ </param>\n+ <when value="no"/>\n+ <when value="history">\n+ <param name="ref" argument="@ARGUMENT@" type="data" format="fasta,fasta.gz" label="Reference"/>\n+ </when>\n+ <when value="cached">\n+ <param name="ref" argument="@ARGUMENT@" type="select" label="Reference">\n+ <options from_data_table="fasta_indexes">\n+ <filter type="data_meta" ref="input" key="dbkey" column="dbkey"/>\n+ </options>\n+ <validat'..b'ed="@S1024@">Read is a PCR or optical duplicate</option>\n+ <option value="2048" selected="@S2048@">Alignment is supplementary</option>\n+ </xml>\n+\n+ <!-- region specification macros and tokens for tools that allow the specification\n+ of region by bed file / space separated list of regions -->\n+ <token name="@REGIONS_FILE@"><![CDATA[\n+ #if $cond_region.select_region == \'tab\':\n+ -t \'$cond_region.targetregions\'\n+ #end if\n+ ]]></token>\n+ <token name="@REGIONS_MANUAL@"><![CDATA[\n+ #if $cond_region.select_region == \'text\':\n+ #for $i, $x in enumerate($cond_region.regions_repeat):\n+ \'${x.region}\'\n+ #end for\n+ #end if\n+ ]]></token>\n+ <xml name="regions_macro">\n+ <conditional name="cond_region">\n+ <param name="select_region" type="select" label="Filter by regions" help="restricts output to only those alignments which overlap the specified region(s)">\n+ <option value="no" selected="True">No</option>\n+ <option value="text">Manualy specify regions</option>\n+ <option value="tab">Regions from tabular file</option>\n+ </param>\n+ <when value="no"/>\n+ <when value="text">\n+ <repeat name="regions_repeat" min="1" default="1" title="Regions">\n+ <param name="region" type="text" label="region" help="format chr:from-to">\n+ <validator type="regex" message="Required format: CHR[:FROM[-TO]]; where CHR: string containing any character except quotes, whitespace and colon; FROM and TO: any integer">^[^\\s\'\\":]+(:\\d+(-\\d+){0,1}){0,1}$</validator>\n+ </param>\n+ </repeat>\n+ </when>\n+ <when value="tab">\n+ <param name="targetregions" argument="-t/--target-regions" type="data" format="tabular" label="Target regions file" help="Do stats in these regions only. Tab-delimited file chr,from,to (1-based, inclusive)" />\n+ </when>\n+ </conditional>\n+ </xml>\n+\n+ <xml name="citations">\n+ <citations>\n+ <citation type="bibtex">\n+ @misc{SAM_def,\n+ title={Definition of SAM/BAM format},\n+ url = {https://samtools.github.io/hts-specs/},}\n+ </citation>\n+ <citation type="doi">10.1093/bioinformatics/btp352</citation>\n+ <citation type="doi">10.1093/bioinformatics/btr076</citation>\n+ <citation type="doi">10.1093/bioinformatics/btr509</citation>\n+ <citation type="bibtex">\n+ @misc{Danecek_et_al,\n+ Author={Danecek, P., Schiffels, S., Durbin, R.},\n+ title={Multiallelic calling model in bcftools (-m)},\n+ url = {http://samtools.github.io/bcftools/call-m.pdf},}\n+ </citation>\n+ <citation type="bibtex">\n+ @misc{Durbin_VCQC,\n+ Author={Durbin, R.},\n+ title={Segregation based metric for variant call QC},\n+ url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}\n+ </citation>\n+ <citation type="bibtex">\n+ @misc{Li_SamMath,\n+ Author={Li, H.},\n+ title={Mathematical Notes on SAMtools Algorithms},\n+ url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}\n+ </citation>\n+ <citation type="bibtex">\n+ @misc{SamTools_github,\n+ title={SAMTools GitHub page},\n+ url = {https://github.com/samtools/samtools},}\n+ </citation>\n+ </citations>\n+ </xml>\n+ <xml name="version_command">\n+ <version_command><![CDATA[samtools 2>&1 | grep Version]]></version_command>\n+ </xml>\n+ <xml name="stdio">\n+ <stdio>\n+ <exit_code range="1:" level="fatal" description="Error" />\n+ </stdio>\n+ </xml>\n+</macros>\n' |
b |
diff -r 000000000000 -r 90f2dd176d80 samtools_coverage.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samtools_coverage.xml Tue Sep 28 15:10:16 2021 +0000 |
[ |
@@ -0,0 +1,126 @@ +<tool id="samtools_coverage" name="Samtools coverage" version="@TOOL_VERSION@" profile="@PROFILE@"> + <description>computes the depth at each position or region</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="requirements"/> + <expand macro="stdio"/> + <expand macro="version_command"/> + <command><![CDATA[ + @PREPARE_IDX@ + samtools coverage + + #if $condition_input.input_pooling == "Yes": + ${ ' '.join( [ "'%s'" % $x for $x in $condition_input.input] ) } + #else + '$condition_input.input' + #end if + + -l $additional_options.min_read_length + -q $additional_options.min_mq + -Q $additional_options.min_bq + + #set $filter = $additional_options.required_flags + @FLAGS@ + -rf $flags + + #set $filter = $additional_options.skipped_flags + @FLAGS@ + -ff $flags + + #if $condition_histogram.histogram_select == "yes" + -m + -w $condition_histogram.n_bins + #if $condition_histogram.region != "": + -r '$condition_histogram.region' + #end if + #end if + + -o '$output' + ]]></command> + <inputs> + <conditional name="condition_input"> + <param name="input_pooling" type="select" label="Are you pooling bam files?" help="Calculate the coverage for multiple bam files" > + <option value="No" selected="True">No</option> + <option value="Yes">Yes</option> + </param> + <when value="No" > + <param name="input" type="data" format="bam" multiple="true" label="BAM file"/> + </when> + <when value="Yes"> + <param name="input" type="data" format="bam" multiple="true" label="BAM files to be pooled"/> + </when> + </conditional> + + <section name="additional_options" title="Additional Options" expanded="true"> + <param name="min_read_length" argument="-l" type="integer" min="0" value="0" label="Minimum read length" help="Ignore reads shorter than INT base pairs (Default = 0)" /> + <param name="min_mq" argument="-q" type="integer" min="0" value="0" label="Minimum mapping quality" help="Minimum mapping quality for an alignment to be used (Default = 0)" /> + <param name="min_bq" argument="-Q" type="integer" min="0" value="0" label="Minimum base quality" help="Minimum base quality for a base to be considered (Default = 0)" /> + + <param name="required_flags" argument="--rf" type="select" multiple="True" label="Require that these flags are set"> + <expand macro="flag_options" /> + </param> + + <param name="skipped_flags" argument="--ff" type="select" multiple="True" label="Exclude reads with any of the following flags set"> + <expand macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/> + </param> + </section> + + <conditional name="condition_histogram"> + <param name="histogram_select" argument="-m" type="select" label="Histogram" help="Show histogram instead of tabular output"> + <option value="no" selected="true">No</option> + <option value="yes">Yes</option> + </param> + <when value="yes"> + <param name="n_bins" argument="-w" type="integer" min="1" value="100" label="Number of bins in histogram" help="Number of bins in histogram" /> + <param name="region" argument="-r" type="text" value="" label="Show specified region" help="Show specified region. Format: chr:start-end." /> + </when> + <when value="no" /> + </conditional> + </inputs> + + <outputs> + <data name="output" format="tabular" from_work_dir="outfile" label="${tool.name} on ${on_string}" /> + </outputs> + + <tests> + <test> + <param name="input" value="test_1.bam" ftype="bam" /> + <output name="output" file="results_1.tabular" ftype="tabular" /> + </test> + <test> + <param name="input" value="test_1.bam" ftype="bam" /> + <param name="histogram_select" value="yes" /> + <param name="n_bins" value="50" /> + <output name="output" file="results_2.txt" ftype="tabular" /> + </test> + <test> + <param name="input_pooling" value="Yes" /> + <param name="input" value="test_1.bam,test_2.bam" ftype="bam" /> + <param name="histogram_select" value="yes" /> + <param name="n_bins" value="100" /> + <output name="output" file="results_3.txt" ftype="tabular" /> + </test> + </tests> + <help><![CDATA[ +**What it does** + +This tool runs the ``samtools coverage`` command. + +Computes the depth at each position or region and draws an ASCII-art histogram or tabulated text. If you select to pool the bam files, then it calculates coverage for the combined files. + +The tabulated form uses the following headings: + +- rname Reference name / chromosome +- startpos Start position +- endpos End position (or sequence length) +- numreads Number reads aligned to the region (after filtering) +- covbases Number of covered bases with depth >= 1 +- coverage Proportion of covered bases [0..1] +- meandepth Mean depth of coverage +- meanbaseq Mean baseQ in covered region +- meanmapq Mean mapQ of selected reads + + ]]></help> + <expand macro="citations"/> +</tool> |
b |
diff -r 000000000000 -r 90f2dd176d80 test-data/test_1.bam |
b |
Binary file test-data/test_1.bam has changed |
b |
diff -r 000000000000 -r 90f2dd176d80 test-data/test_2.bam |
b |
Binary file test-data/test_2.bam has changed |