Repository 'samtools_slice_bam'
hg clone https://toolshed.g2.bx.psu.edu/repos/devteam/samtools_slice_bam

Changeset 4:344fc91e1bfd (2021-09-28)
Previous changeset 3:a4a10c7924d1 (2017-05-09) Next changeset 5:b5c88b7b153e (2023-11-20)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_slice_bam commit 0f75269223c0821c6c82acf98fde947d0f816f2b"
modified:
macros.xml
samtools_slice_bam.xml
test-data/bam-slice-test1.bam
test-data/bam-slice-test2.bam
test-data/bam-slice-test3.bam
b
diff -r a4a10c7924d1 -r 344fc91e1bfd macros.xml
--- a/macros.xml Tue May 09 11:17:27 2017 -0400
+++ b/macros.xml Tue Sep 28 16:16:30 2021 +0000
[
b'@@ -1,11 +1,182 @@\n <macros>\n     <xml name="requirements">\n         <requirements>\n-            <requirement type="package" version="1.3.1">samtools</requirement>\n+            <requirement type="package" version="@TOOL_VERSION@">samtools</requirement>\n             <yield/>\n         </requirements>\n     </xml>\n-    <token name="@TOOL_VERSION@">1.3.1</token>\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+                      '..b' paired</option>\n+        <option value="2" selected="@S2@">Read is mapped in a proper pair</option>\n+        <option value="4" selected="@S4@">Read is unmapped</option>\n+        <option value="8" selected="@S8@">Mate is unmapped</option>\n+        <option value="16" selected="@S16@">Read is mapped to the reverse strand of the reference</option>\n+        <option value="32" selected="@S32@">Mate is mapped to the reverse strand of the reference</option>\n+        <option value="64" selected="@S64@">Read is the first in a pair</option>\n+        <option value="128" selected="@S128@">Read is the second in a pair</option>\n+        <option value="256" selected="@S256@">Alignment of the read is not primary</option>\n+        <option value="512" selected="@S512@">Read fails platform/vendor quality checks</option>\n+        <option value="1024" selected="@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@@ -49,21 +220,4 @@\n             <exit_code range="1:" level="fatal" description="Error" />\n         </stdio>\n     </xml>\n-    <token name="@no-chrom-options@">\n------\n-\n-.. class:: warningmark\n-\n-**No options available? How to re-detect metadata**\n-\n-If you see a &quot;No options available&quot; within the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop down, you need to re-detect metadata for the dataset you are trying to process. To do this follow these steps:\n-\n-1. Click on the **pencil** icon adjacent to the dataset in the history\n-2. A new menu will appear in the center pane of the interface\n-3. Click **Datatype** tab\n-4. Set **New Type** to **BAM**\n-5. Click **Save**\n-\n-The medatada will be re-detected and you will be able to see the list of reference sequences in the &quot;**Select references (chromosomes and contigs) you would like to restrict bam to**&quot; drop-down.\n-    </token>\n </macros>\n'
b
diff -r a4a10c7924d1 -r 344fc91e1bfd samtools_slice_bam.xml
--- a/samtools_slice_bam.xml Tue May 09 11:17:27 2017 -0400
+++ b/samtools_slice_bam.xml Tue Sep 28 16:16:30 2021 +0000
[
@@ -1,4 +1,4 @@
-<tool id="samtools_slice_bam" name="Slice" version="2.0.1">
+<tool id="samtools_slice_bam" name="Slice" version="2.0.2" profile="@PROFILE@">
     <description>BAM by genomic regions</description>
     <macros>
         <import>macros.xml</import>
@@ -13,12 +13,12 @@
     ln -s '${input_bam.metadata.bam_index}' temp_input.bam.bai &&
 
     #if str($slice_method.slice_method_selector) == "bed":
-        samtools view -@ \${GALAXY_SLOTS:-1} -b -L "${input_interval}" -o unsorted_output.bam temp_input.bam && 
+        samtools view -@ \${GALAXY_SLOTS:-1} -b -L "${input_interval}" -o unsorted_output.bam temp_input.bam &&
     #elif str($slice_method.slice_method_selector) == "chr":
-        samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam 
+        samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam
         ${ ' '.join( map( lambda x:'"%s"' % ( x ), str( $slice_method.refs ).split(",") ) ) } &&
     #elif str($slice_method.slice_method_selector) == "man":
-        samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam 
+        samtools view -@ \${GALAXY_SLOTS:-1} -b -o unsorted_output.bam temp_input.bam
 
         #for $region in $slice_method.regions:
             "${region.chrom}:${region.start}-${region.end}"
@@ -28,7 +28,7 @@
 
     samtools sort
         -O bam
-        -T sorted
+        -T "\${TMPDIR:-.}"
         -@ \${GALAXY_SLOTS:-1}
         -o '${output_bam}'
         unsorted_output.bam
@@ -83,13 +83,13 @@
             <param name="input_bam" ftype="bam" value="bam-slice-input.bam" />
             <param name="slice_method_selector" value="bed"/>
             <param name="input_interval" ftype="bed" value="bam-slice.bed" />
-            <output name="output_bam" file="bam-slice-test1.bam" ftype="bam" />
+            <output name="output_bam" file="bam-slice-test1.bam" ftype="bam" lines_diff="4" />
         </test>
         <test>
             <param name="input_bam" ftype="bam" value="bam-slice-input.bam" />
             <param name="slice_method_selector" value="chr"/>
             <param name="refs" value="chrM" />
-            <output name="output_bam" file="bam-slice-test2.bam" ftype="bam" />
+            <output name="output_bam" file="bam-slice-test2.bam" ftype="bam" lines_diff="4" />
         </test>
         <test>
             <param name="input_bam" ftype="bam" value="bam-slice-input.bam" />
@@ -97,7 +97,7 @@
             <param name="chrom" value="chrM" />
             <param name="start" value="1" />
             <param name="end" value="1000" />
-            <output name="output_bam" file="bam-slice-test3.bam" ftype="bam" />
+            <output name="output_bam" file="bam-slice-test3.bam" ftype="bam" lines_diff="4"/>
         </test>
     </tests>
     <help><![CDATA[
@@ -106,7 +106,7 @@
 Allows to restrict (slice) input BAM dataset to a list of intervals defined in a BED file, individual chromosomes, or manually set list of coordinates.
 BED datasets can be obtained from **Get Data -> UCSC Main**.
 
-This tool is based on ``samtools view`` command. 
+This tool is based on ``samtools view`` command.
 
 @no-chrom-options@
     ]]></help>
b
diff -r a4a10c7924d1 -r 344fc91e1bfd test-data/bam-slice-test1.bam
b
Binary file test-data/bam-slice-test1.bam has changed
b
diff -r a4a10c7924d1 -r 344fc91e1bfd test-data/bam-slice-test2.bam
b
Binary file test-data/bam-slice-test2.bam has changed
b
diff -r a4a10c7924d1 -r 344fc91e1bfd test-data/bam-slice-test3.bam
b
Binary file test-data/bam-slice-test3.bam has changed