changeset 4:a287431cdf4f draft

"planemo upload for repository https://github.com/davebx/bioext-gx/ commit c9002fa57e4d800f2c1c8d1dafbceb7681b0fcc2"
author iuc
date Tue, 05 Oct 2021 09:52:56 +0000
parents fb4975b507c6
children c239e93d9f04
files bealign.xml test-data/bealign-out3-background.bam test-data/bealign_selection.loc
diffstat 3 files changed, 30 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/bealign.xml	Fri Aug 20 21:04:17 2021 +0000
+++ b/bealign.xml	Tue Oct 05 09:52:56 2021 +0000
@@ -3,10 +3,11 @@
     <description>to a reference using a codon alignment algorithm</description>
     <macros>
         <import>macros.xml</import>
-        <token name="@VERSION_SUFFIX@">1</token>
+        <token name="@VERSION_SUFFIX@">2</token>
     </macros>
     <expand macro="requirements">
         <requirement type="package" version="5.1.0">gawk</requirement>
+        <requirement type="package" version="1.13">samtools</requirement>
     </expand>
     <version_command>bealign --version</version_command>
     <command detect_errors="exit_code">
@@ -18,8 +19,10 @@
     ## and replace any unwanted characters in the sequence names with underscores.
     ## This should not affect the actual alignment, since any non-standard character
     ## in the sequences is already ignored, but the possibility remains.
+    set -o pipefail;
     cat '$input' @SANITIZE@ reads.fa &&
-    bealign --reference '$select_reference.reference' --alphabet $advanced.alphabet
+    ## bealign's parallel job executor uses the NCPU env variable
+    NCPU=\${GALAXY_SLOTS:-2} bealign --reference '$select_reference.reference' --alphabet $advanced.alphabet
         #if $advanced.expected_identity:
             --expected-identity $advanced.expected_identity
         #end if
@@ -29,26 +32,32 @@
         --score-matrix $advanced.score_matrix
         $advanced.reverse_complement
         $advanced.keep_reference
-        reads.fa '$output'
-        #set $input_background = False
-        #if $background_source.selection == 'history':
-            #if $background_source.sequences:
-                #set $input_background = $background_source.sequences
-            #end if
-        #else:
-            #if $background_source.sequences:
-                #set $input_background = $background_source.sequences.fields.path
-            #end if
+        ## bypass bealign's internal pysam-based, single-threaded BAM sorting
+        --no-sort
+        reads.fa bealign_out.bam &&
+    samtools sort -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$output' bealign_out.bam
+    #set $input_background = False
+    #if $background_source.selection == 'history':
+        #if $background_source.sequences:
+            #set $input_background = $background_source.sequences
+        #end if
+    #else:
+        #if $background_source.sequences:
+            #set $input_background = $background_source.sequences.fields.path
         #end if
-        #if $input_background:
-            && cat '$input_background' @SANITIZE@ background.fa &&
-            bealign --reference '$select_reference.reference' --alphabet $advanced.alphabet
-            #if $advanced.expected_identity:
-                --expected-identity $advanced.expected_identity
-            #end if
-            --keep-reference --score-matrix $advanced.score_matrix $advanced.reverse_complement 
-                background.fa '$background'
+    #end if
+    #if $input_background:
+        && cat '$input_background' @SANITIZE@ background.fa &&
+        NCPU=\${GALAXY_SLOTS:-2} bealign --reference '$select_reference.reference' --alphabet $advanced.alphabet
+        #if $advanced.expected_identity:
+            --expected-identity $advanced.expected_identity
         #end if
+        --keep-reference --score-matrix $advanced.score_matrix $advanced.reverse_complement
+        ## bypass bealign's internal pysam-based, single-threaded BAM sorting
+        --no-sort
+        background.fa bealign_background.bam &&
+        samtools sort -@\${GALAXY_SLOTS:-2} -T "\${TMPDIR:-.}" -O bam -o '$background' bealign_background.bam
+    #end if
     #set $reference_name = str($select_reference.reference)
     #if $select_reference.reference_type == 'preset' and $select_reference.save_reference:
         && python '$__tool_directory__/copy_reference.py' --reference '$reference_name' --dataset '$saved_reference'
Binary file test-data/bealign-out3-background.bam has changed
--- a/test-data/bealign_selection.loc	Fri Aug 20 21:04:17 2021 +0000
+++ b/test-data/bealign_selection.loc	Tue Oct 05 09:52:56 2021 +0000
@@ -1,1 +1,1 @@
-CoV2-nsp8	SARS-CoV-2: nsp8	${HERE}/nsp8.fa
+CoV2-nsp8	SARS-CoV-2: nsp8	${__HERE__}/nsp8.fa