diff sam_dump.xml @ 23:6669afa92957 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/sra-tools commit cbb1499906c801443d72bdf313d86f0182aca010
author iuc
date Sun, 22 Jan 2023 17:51:28 +0000
parents fe99dc15b7af
children
line wrap: on
line diff
--- a/sam_dump.xml	Fri Sep 03 16:17:17 2021 +0000
+++ b/sam_dump.xml	Sun Jan 22 17:51:28 2023 +0000
@@ -1,23 +1,21 @@
-<tool id="sam_dump" name="Download and Extract Reads in BAM" version="@VERSION@+galaxy0" profile="18.01">
+<tool id="sam_dump" name="Download and Extract Reads in BAM" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
     <description>format from NCBI SRA</description>
-    <expand macro="bio_tools"/>
     <macros>
-        <import>sra_macros.xml</import>
+        <import>macros.xml</import>
     </macros>
-    <expand macro="requirements">
-        <requirement type="package" version="1.10">samtools</requirement>
-    </expand>
-    <version_command>sam-dump --version</version_command>
-    <command detect_errors="exit_code">
-<![CDATA[
+    <expand macro="edam_ontology"/>
+    <expand macro="bio_tools"/>
+    <expand macro="requirements"/>
+    <version_command>sam-dump --version | tr -d $'\n'</version_command>
+    <command detect_errors="exit_code"><![CDATA[
         @COPY_CONFIGFILE@
         @SET_ACCESSIONS@
 
         ## Do not use prefetch if region is specified, to avoid downloading
         ## the complete sra file.
 
-        #if $input.input_select == "file":
-            sam-dump --log-level fatal  '${input.file.name}'
+        #if $input.input_select == "sra_file":
+            sam-dump --log-level fatal  --accession '\$acc'
         #else:
             #if ( str( $adv.region ) == "" ):
                 prefetch -X 200000000 "\$acc" &&
@@ -45,32 +43,18 @@
         #if (str( $adv.primary ) == "yes") and (str ( $adv.alignments != "unaligned") ):
             --primary
         #end if
-        #if $input.input_select == "file":
-            '$input.file'
-        #elif $input.input_select == "accession_number":
-            "\$acc"
-        #elif $input.input_select=="file_list":
-            "\$acc"
-        #end if
+        "\$acc"
 
         #if str( $outputformat ) == "bam":
-            | samtools view -Sb - 2> /dev/null
-        #end if
-        #if $input.input_select == "file":
-            > '$output_file'
-        #elif $input.input_select == "accession_number":
-            > '$output_accession' )
+            | samtools view -Sb - 2> /dev/null > "\$acc.bam"
+        #elif str( $outputformat ) == "sam":
+            > "\$acc.sam"
         #end if
-
-        #if $input.input_select=="file_list":
-                 #if str( $outputformat ) == "bam":
-                      > "\$acc.bam"
-                 #elif str( $outputformat ) == "sam":
-                      > "\$acc.sam"
-                 #end if
-        ) ; done
+        
+        #if $input.input_select != "sra_file":
+            ); done;
         #end if
-
+        echo "Done with all accessions."
         ]]>
     </command>
     <expand macro="configfile_hack"/>
@@ -93,23 +77,10 @@
         </section>
     </inputs>
     <outputs>
-        <collection name="output_collection" type="list" label="SAM/BAM data (fastq-dump)">
-          <filter>input['input_select'] == "file_list"</filter>
-          <discover_datasets pattern="(?P&lt;designation&gt;.+)\.bam" directory="." ext='bam'/>
-          <discover_datasets pattern="(?P&lt;designation&gt;.+)\.sam" directory="." ext='sam'/>
+        <collection name="output_collection" type="list" label="sam-dump: Downloaded SAM/BAM data">
+            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.bam" directory="." ext='bam'/>
+            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.sam" directory="." ext='sam'/>
         </collection>
-        <data name="output_accession" format="bam" label="${input.accession} (sam-dump)">
-            <filter>input['input_select'] == "accession_number"</filter>
-            <change_format>
-                <when input="outputformat" value="sam" format="sam"/>
-            </change_format>
-        </data>
-        <data name="output_file" format="bam" label="${input.file.name} (sam-dump)">
-            <filter>input['input_select'] == "file"</filter>
-            <change_format>
-                <when input="outputformat" value="sam" format="sam"/>
-            </change_format>
-        </data>
     </outputs>
     <tests>
         <test>
@@ -117,60 +88,38 @@
             <param name="accession" value="SRR925743"/>
             <param name="outputformat" value="sam"/>
             <param name="region" value="17:41243452-41277500"/>
-            <output name="output_accession" file="sam_dump_result.sam" compare="contains" ftype="sam"/>
+            <output_collection name="output_collection" type="list" count="1">
+                <element name="SRR925743" file="SRR925743_sam_dump_result.sam" compare="contains" ftype="sam"/>
+            </output_collection>
+        </test>
+        <test>
+            <param name="input_select" value="accession_number"/>
+            <param name="accession" value="SRR925743,SRR522874"/>
+            <param name="outputformat" value="sam"/>
+            <param name="region" value="17:41243452-41277500"/>
+            <output_collection name="output_collection" type="list" count="2">
+                <element name="SRR522874" file="SRR522874_sam_dump_result.sam" compare="contains" ftype="sam"/>
+                <element name="SRR925743" file="SRR925743_sam_dump_result.sam" compare="contains" ftype="sam"/>
+            </output_collection>
         </test>
     </tests>
     <help><![CDATA[
 
 **What it does?**
 
-This tool extracts data (in BAM_ format) from the Short Read Archive (SRA) at the National Center for Biotechnology Information (NCBI). It is based on the sam-dump_ utility of the SRA Toolkit.
-
-**How to use it?**
-
-There are three ways in which you can download data:
-
- 1. Data for single accession
- 2. Multiple datasets using a list of accessions
- 3. Extract data from already uploaded SRA dataset
-
-Below we discuss each in detail.
-
-------
-
-**Uploading data for a single accession**
-
-When you type a single accession number (e.g., `SRR1582967`) into **Accession** box and click **Execute** the tool will fetch data for you. As a result you will get a single BAM (or SAM) dataset in the history.
+This tool extracts data (in BAM_ format) from the Short Read Archive (SRA) at the National Center for Biotechnology Information (NCBI). It is based on the sam-dump_ utility of the SRA Toolkit and returns a collection of NGS data containing one file for each accession number provided.
 
------
 
-**Uploading multiple datasets using a list of accessions**
-
-A more realistic scenario is when you want to upload a number of datasets at once. To do this you need a list of accession, where there is only one accession per line (see below for information on how to generate such a file). Once you have this file:
-
- 1. Upload it into your history using Galaxy's upload tool
- 2. Once the list of accessions is uploaded choose *List of SRA accessions, one per line* from **select input type** dropdown
- 3. Choose uploaded file within the **sra accession list** field
- 4. Click **Execute**
-
-.. class:: warningmark
-
-BAM datasets produced by this option will be saved in Galaxy's history as a collection_ - a single history element containing multiple datasets.
-
------
-
-**Extract data from already uploaded SRA dataset**
-
-If a SRA dataset is present in the history, it can be converted into BAM dataset by setting **select input type** drop-down to *SRA archive in current history*. Just like in the case of extracting data for single accession number a single BAM dataset will be generated in the history.
+@HOW_TO_USE_IT@
 
 @ACCESSION_LIST_HOWTO@
 
 -----
 
+.. _sam-dump: https://github.com/ncbi/sra-tools
 .. _BAM: https://samtools.github.io/hts-specs/SAMv1.pdf
-.. _sam-dump: https://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=toolkit_doc&f=sam-dump
 .. _collection: https://galaxyproject.org/tutorials/collections/
-.. _link: https://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=studies
+.. _link: https://trace.ncbi.nlm.nih.gov/Traces/index.html?view=run_browser&display=reads
 
 @SRATOOLS_ATTRRIBUTION@
     ]]></help>