changeset 31:1429b9638055 draft

planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/ncbi_egapx commit 7fab8f3658c9289e1d229bcde0beff80a0814c4c
author richard-burhans
date Wed, 26 Mar 2025 20:17:43 +0000
parents 21d4de0e41fc
children 588b73318a45
files get-bams.bash macros.xml ncbi_egapx.xml
diffstat 3 files changed, 67 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get-bams.bash	Wed Mar 26 20:17:43 2025 +0000
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+##
+## Collect output bam files from STAR
+##
+
+bam_temp_dir=$(mktemp --directory ./egapx_out/bam.XXXXXXXXXX) || {
+    echo "ERROR: failed making temporary directory"
+    exit 1
+}
+
+bam_files_file="$bam_temp_dir/bam-files.txt"
+touch "$bam_files_file" || {
+    echo "ERROR: failed creating temporary file"
+    exit 1
+}
+trap 'rm -f -- "$bam_files_file"' EXIT
+
+find . -type f -name \*Aligned.out.Sorted.bam -print > "$bam_files_file" || {
+    echo "ERROR: failed finding bam files"
+    exit 1
+}
+
+idx=0
+while IFS="" read pathname; do
+    filename=$(basename "$pathname" ".bam")
+
+    dest_path_prefix="$bam_temp_dir/$filename"
+    if [ -e "${dest_path_prefix}.bam" ]; then
+        dest_path_prefix="${dest_path_prefix}.${idx}"
+        idx=$((idx + 1))
+    fi
+    dest_pathname="${dest_path_prefix}.bam"
+
+    cp "$pathname" "$dest_pathname" || {
+        echo "ERROR: failed: cp \"$pathname\" \"$dest_pathname\""
+        exit 1
+    }
+
+done < "$bam_files_file"
+
+exit 0
--- a/macros.xml	Mon Feb 17 19:17:19 2025 +0000
+++ b/macros.xml	Wed Mar 26 20:17:43 2025 +0000
@@ -5,7 +5,7 @@
         </requirements>
     </xml>
     <token name="@TOOL_VERSION@">0.3.2-alpha</token>
-    <token name="@VERSION_SUFFIX@">3</token>
+    <token name="@VERSION_SUFFIX@">4</token>
     <token name="@PROFILE@">23.0</token>
     <xml name="edam_ontology">
         <edam_operations>
--- a/ncbi_egapx.xml	Mon Feb 17 19:17:19 2025 +0000
+++ b/ncbi_egapx.xml	Wed Mar 26 20:17:43 2025 +0000
@@ -5,6 +5,9 @@
     </macros>
     <expand macro="edam_ontology"/>
     <expand macro="requirements"/>
+    <required_files>
+        <include path="get-bams.bash"/>
+    </required_files>
     <command detect_errors="aggressive"><![CDATA[
     #if $cond_input_style.input_style == "fillform"
         #set yamlconfig = $egapx_config
@@ -54,6 +57,9 @@
     python3 /galaxy/egapx/ui/egapx.py '$yamlconfig' -e galaxy -o 'egapx_out' &&
     ## hack to support 0.2-alpha
     if [ -e egapx_out/accept.gff ]; then ln -s accept.gff egapx_out/complete.genomic.gff; fi
+    #if $developer.collect_star_bams
+    && bash '$__tool_directory__/get-bams.bash'
+    #end if
     ]]></command>
     <environment_variables>
          <environment_variable name="NXF_DEBUG">3</environment_variable>
@@ -98,10 +104,10 @@
 taxid: $taxid
             #if $cond_input_style.cond_rnaseq_style.rnaseq_style == "history"
 reads: $reads_config
-    #else
+            #else
 reads:
-        #set reads_values = $rnaseq.split()
-        #for $read in [str(rv).strip() for rv in $reads_values]
+                #set reads_values = $rnaseq.split()
+                #for $read in [str(rv).strip() for rv in $reads_values]
   - $read
                 #end for
             #end if
@@ -180,6 +186,9 @@
                 <param name="yamlin" type="data" format="yaml" label="egapx configuration yaml file to pass to Nextflow"/>
             </when>
         </conditional>
+        <section name="developer" title="Developer options" expanded="false">
+            <param name="collect_star_bams" type="boolean" checked="false" label="Collect BAM output from STAR"/>
+        </section>
     </inputs>
     <outputs>
         <data name="complete_genomic_gff" format="gff" label="Final annotation for ${on_string}" from_work_dir="egapx_out/complete.genomic.gff"/>
@@ -202,11 +211,15 @@
             <data name="run_timeline" format="html" label="Nextflow execution timeline" from_work_dir="egapx_out/run.timeline.html"/>
             <data name="nextflow_log" format="txt" label="Nextflow execution log" from_work_dir="egapx_out/nextflow.log"/>
             <data name="run_trace" format="tabular" label="Nextflow trace file" from_work_dir="egapx_out/run.trace.txt"/>
-            <data name="run_params" format="yaml" label="Nextflow run parameters" from_work_dir="egapx_out/run_params.yaml"/>
+           <data name="run_params" format="yaml" label="Nextflow run parameters" from_work_dir="egapx_out/run_params.yaml"/>
+        </collection>
+        <collection name="star_alignments" type="list" label="EGAPx STAR alignments for ${on_string}">
+            <discover_datasets pattern="bam\.[0-9A-Za-z]{10}/(?P&lt;designation&gt;.+)\.bam" format="bam" directory="egapx_out" recurse="true" match_relative_path="true"/>
+            <filter>developer['collect_star_bams']</filter>
         </collection>
     </outputs>
     <tests>
-        <test expect_test_failure="true">
+        <test expect_num_outputs="20" expect_test_failure="true">
             <param name="input_style" value="fillform"/>
             <param name="taxid" value="6954"/>
             <param name="genome_style" value="uri"/>
@@ -215,9 +228,10 @@
             <param name="rnaseq" value="https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/EGAP/sample_data/Dermatophagoides_farinae_small/SRR8506572_1.gz https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/EGAP/sample_data/Dermatophagoides_farinae_small/SRR8506572_2.gz https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/EGAP/sample_data/Dermatophagoides_farinae_small/SRR9005248_1.gz https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/EGAP/sample_data/Dermatophagoides_farinae_small/SRR9005248_2.gz"/>
             <expand macro="test_outputs"/>
         </test>
-        <test expect_test_failure="true">
+        <test expect_num_outputs="21" expect_test_failure="true">
             <param name="input_style" value="history"/>
             <param name="yamlin" value="input.yaml"/>
+            <param name="collect_star_bams" value="true"/>
             <expand macro="test_outputs"/>
         </test>
     </tests>