comparison macros.xml @ 2:b40e2d865d52 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_merge commit 1354b1358df89a922c3243f7e27ce789094b8644"
author iuc
date Sun, 19 Dec 2021 15:57:10 +0000
parents 8890e2d4c068
children 36677f429310
comparison
equal deleted inserted replaced
1:8890e2d4c068 2:b40e2d865d52
48 #end if 48 #end if
49 #end if 49 #end if
50 #end for 50 #end for
51 ]]></token> 51 ]]></token>
52 <token name="@PREPARE_FASTA_IDX@"><![CDATA[ 52 <token name="@PREPARE_FASTA_IDX@"><![CDATA[
53 ##checks for reference data ($addref_cond.addref_select=="history" or =="cached") 53 ## Make the user-selected reference genome, if any, accessible through
54 ##and sets the -t/-T parameters accordingly: 54 ## a shell variable $reffa, index the reference if necessary, and make
55 ##- in case of history a symbolic link is used because samtools (view) will generate 55 ## the fai-index file available through a shell variable $reffai.
56 ## the index which might not be possible in the directory containing the fasta file 56
57 ##- in case of cached the absolute path is used which allows to read the cram file 57 ## For a cached genome simply sets the shell variables to point to the
58 ## without specifying the reference 58 ## genome file and its precalculated index.
59 ## For a genome from the user's history, if that genome is a plain
60 ## fasta file, the code creates a symlink in the pwd, creates the fai
61 ## index file next to it, then sets the shell variables to point to the
62 ## symlink and its index.
63 ## For a fasta.gz dataset from the user's history, it tries the same,
64 ## but this will only succeed if the file got compressed with bgzip.
65 ## For a regular gzipped file samtools faidx will fail, in which case
66 ## the code falls back to decompressing to plain fasta before
67 ## reattempting the indexing.
68 ## Indexing of a bgzipped file produces a regular fai index file *and*
69 ## a compressed gzi file. The former is identical to the fai index of
70 ## the uncompressed fasta.
71
72 ## If the user has not selected a reference (it's an optional parameter
73 ## in some samtools wrappers), a cheetah boolean use_ref is set to
74 ## False to encode that fact.
75
76 #set use_ref=True
59 #if $addref_cond.addref_select == "history": 77 #if $addref_cond.addref_select == "history":
60 ln -s '${addref_cond.ref}' reference.fa && 78 #if $addref_cond.ref.is_of_type('fasta'):
61 samtools faidx reference.fa && 79 reffa="reference.fa" &&
62 #set reffa="reference.fa" 80 ln -s '${addref_cond.ref}' \$reffa &&
63 #set reffai="reference.fa.fai" 81 samtools faidx \$reffa &&
82 #else:
83 reffa="reference.fa.gz" &&
84 ln -s '${addref_cond.ref}' \$reffa &&
85 {
86 samtools faidx \$reffa ||
87 {
88 echo "Failed to index compressed reference. Trying decompressed ..." 1>&2 &&
89 gzip -dc \$reffa > reference.fa &&
90 reffa="reference.fa" &&
91 samtools faidx \$reffa;
92 }
93 } &&
94 #end if
95 reffai=\$reffa.fai &&
64 #elif $addref_cond.addref_select == "cached": 96 #elif $addref_cond.addref_select == "cached":
65 #set reffa=str($addref_cond.ref.fields.path) 97 ## in case of cached the absolute path is used which allows to read
66 #set reffai=str($addref_cond.ref.fields.path)+".fai" 98 ## a cram file without specifying the reference
99 reffa='${addref_cond.ref.fields.path}' &&
100 reffai=\$reffa.fai &&
67 #else 101 #else
68 #set reffa=None 102 #set use_ref=False
69 #set reffai=None
70 #end if 103 #end if
71 ]]></token> 104 ]]></token>
72 105
73 <xml name="optional_reference"> 106 <xml name="optional_reference">
74 <conditional name="addref_cond"> 107 <conditional name="addref_cond">