From b130df43de752813f684a68f954220e5bcab57de Mon Sep 17 00:00:00 2001
From: mvdbeek <m.vandenbeek@gmail.com>
Date: Wed, 22 Nov 2023 16:50:06 +0100
Subject: [PATCH] Fix snpeffdb output to not contain broken symlinks

Instead just copy out the actual .bin files.
---
 tool_collections/snpeff/snpEff_create_db.xml | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/tool_collections/snpeff/snpEff_create_db.xml b/tool_collections/snpeff/snpEff_create_db.xml
index f06b1af3f1b..491c69294f7 100644
--- a/tool_collections/snpeff/snpEff_create_db.xml
+++ b/tool_collections/snpeff/snpEff_create_db.xml
@@ -1,4 +1,4 @@
-<tool id="snpEff_build_gb" name="SnpEff build:" version="@WRAPPER_VERSION@.galaxy5">
+<tool id="snpEff_build_gb" name="SnpEff build:" version="@WRAPPER_VERSION@.galaxy6">
     <description> database from Genbank or GFF record</description>
     <macros>
         <import>snpEff_macros.xml</import>
@@ -14,25 +14,25 @@
             python3 '$__tool_directory__/gbk2fa.py' '${input_type.input}' '${output_fasta}' ${input_type.remove_version} &&
         #end if
 
-        mkdir -p '${snpeff_output.files_path}'/'${genome_version}' &&
+        mkdir -p snpeff_output/'${genome_version}' &&
 
         #if str($input_type.input_type_selector) == "gb":
             #if $input_type.input.is_of_type("genbank"):
-                ln -s '${input_type.input}' '${snpeff_output.files_path}/${genome_version}/genes.gbk' &&
+                ln -s '${input_type.input}' 'snpeff_output/${genome_version}/genes.gbk' &&
             #elif $input_type.input.is_of_type("genbank.gz"):
-                ln -s '${input_type.input}' '${snpeff_output.files_path}/${genome_version}/genes.gbk.gz' &&
+                ln -s '${input_type.input}' 'snpeff_output/${genome_version}/genes.gbk.gz' &&
             #end if
         #else:
             #if $input_type.reference_source.reference_source_selector == "history":
                 #if $input_type.reference_source.input_fasta.is_of_type("fasta"):
-                    ln -s '${input_type.reference_source.input_fasta}' '${snpeff_output.files_path}/${genome_version}/sequences.fa' &&
+                    ln -s '${input_type.reference_source.input_fasta}' 'snpeff_output/${genome_version}/sequences.fa' &&
                 #elif $input_type.reference_source.input_fasta.is_of_type("fasta.gz"):
-                    ln -s '${input_type.reference_source.input_fasta}' '${snpeff_output.files_path}/${genome_version}/sequences.fa.gz' &&
+                    ln -s '${input_type.reference_source.input_fasta}' 'snpeff_output/${genome_version}/sequences.fa.gz' &&
                 #end if
             #elif $input_type.reference_source.reference_source_selector == "cached":
-                ln -s '${input_type.reference_source.ref_file.fields.path}' '${snpeff_output.files_path}/${genome_version}/sequences.fa' &&
+                ln -s '${input_type.reference_source.ref_file.fields.path}' 'snpeff_output/${genome_version}/sequences.fa' &&
             #end if
-            ln -s '${input_type.input}' '${snpeff_output.files_path}/${genome_version}/genes.${input_type.input_type_selector}' &&
+            ln -s '${input_type.input}' 'snpeff_output/${genome_version}/genes.${input_type.input_type_selector}' &&
         #end if
 
         snpEff @JAVA_OPTIONS@ build -v
@@ -45,7 +45,8 @@
         #elif str($input_type.input_type_selector) == "gtf":
             -gtf22
         #end if
-        -dataDir '${snpeff_output.files_path}' '${genome_version}' &&
+        -dataDir snpeff_output '${genome_version}' &&
+        mv snpeff_output/*.bin '${snpeff_output.files_path}' &&
         echo '${genome_version}.genome : ${genome_version}' >> '${snpeff_output.files_path}'/snpEff.config &&
         echo '${genome_version}.codonTable : ${codon_table}' >> '${snpeff_output.files_path}'/snpEff.config
     ]]></command>