Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/maxbin2/.lint_skip

This file was deleted.

248 changes: 166 additions & 82 deletions tools/maxbin2/maxbin2.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="maxbin2" name="MaxBin2" version="@MAXBIN_VERSION@+galaxy6">
<tool id="maxbin2" name="MaxBin2" version="@MAXBIN_VERSION@+galaxy7">
<description>clusters metagenomic contigs into bins</description>
<macros>
<token name="@MAXBIN_VERSION@">2.2.7</token>
Expand All @@ -24,82 +24,120 @@
</requirements>
<version_command><![CDATA[run_MaxBin.pl -version | head -n 1]]></version_command>
<command detect_errors="exit_code"><![CDATA[
## generate read or abundance files
#import re
#if $assembly.inputs.type == 'reads'
#if $assembly.type == 'individual'
## uncompress .gz reads files if necessary
#set $e = $assembly.inputs.reads
#set $identifier = re.sub('[^\w\-\\.]', '_', str($e.element_identifier))
#if $e.ext.endswith(".gz")
gunzip -c '$e' > '$identifier' &&
echo '$identifier' >> reads_list &&
#else
ln -s '$e' '$identifier' &&
echo '$identifier' >> reads_list &&
## generate read or abundance files
#import re
#if $assembly.inputs.type == 'reads'
#if $assembly.type == 'individual'
## uncompress .gz reads files if necessary
#set $e = $assembly.inputs.reads
#set $identifier = re.sub('[^\w\-\\.]', '_', str($e.element_identifier))
#if $e.ext.endswith(".gz")
gunzip -c '$e' > '$identifier' &&
echo '$identifier' >> reads_list &&
#else
ln -s '$e' '$identifier' &&
echo '$identifier' >> reads_list &&
#end if
#else
#for $i, $r in enumerate($assembly.inputs.reads)
#if $r
#set $identifier = re.sub('[^\w\-\\.]', '_', str($r.element_identifier))
#set $newid = $identifier + '_' + str($i)
#if $r.ext.endswith(".gz")
gunzip -c '$r' > '$newid' &&
echo '$newid' >> reads_list &&
#else
ln -s '$r' '$newid' &&
echo '$newid' >> reads_list &&
#end if
#end if
#end for
#end if
#else
#for $i, $r in enumerate($assembly.inputs.reads)
#if $r
#set $identifier = re.sub('[^\w\-\\.]', '_', str($r.element_identifier))
#set $newid = $identifier + '_' + str($i)
#if $r.ext.endswith(".gz")
gunzip -c '$r' > '$newid' &&
echo '$newid' >> reads_list &&
#else
ln -s '$r' '$newid' &&
echo '$newid' >> reads_list &&
#else if $assembly.inputs.type == 'abund'
#if $assembly.type == 'individual'
echo '$assembly.inputs.abund' >> abund_list &&
#else
#for $a in $assembly.inputs.abund
#if $a
echo '$a' >> abund_list &&
#end if
#end if
#end for
#end for
#end if
#end if
#else if $assembly.inputs.type == 'abund'
#if $assembly.type == 'individual'
echo '$assembly.inputs.abund' >> abund_list &&
#else
#for $a in $assembly.inputs.abund
#if $a
echo '$a' >> abund_list &&
#end if
#end for

## in case of reassembly the IBDA out and err is appended
## to differentiate this a header is added also befor the
## MaxBin2 outputs
#if $assembly.inputs.type == 'reads' and $assembly.inputs.reassembly != ""
echo "==== MaxBin2 stdout ====" &&
echo "==== MaxBin2 stderr ====" 1>&2 &&
#end if
#end if

## in case of reassembly the IBDA out and err is appended
## to differentiate this a header is added also befor the
## MaxBin2 outputs
#if $assembly.inputs.type == 'reads' and $assembly.inputs.reassembly != ""
echo "==== MaxBin2 stdout ====" &&
echo "==== MaxBin2 stderr ====" 1>&2 &&
#end if
(run_MaxBin.pl
-contig '$contig'
-out out
#if $assembly.inputs.type == 'reads':
-reads_list reads_list
$assembly.inputs.reassembly
#else if $assembly.inputs.type == 'abund':
-abund_list abund_list
#end if
-min_contig_length $adv.min_contig_length
-max_iteration $adv.max_iteration
-prob_threshold $adv.prob_threshold
$output.plotmarker
-markerset $output.markerset
-thread \${GALAXY_SLOTS:-1}
> maxbin.stdout 2> maxbin.stderr
Comment thread
SantaMcCloud marked this conversation as resolved.
Outdated
||
(
if grep -qi "cannot be binned" maxbin.stdout maxbin.stderr; then

echo "MaxBin2 could not bin dataset. Creating empty fallback outputs." ;
Comment thread
SantaMcCloud marked this conversation as resolved.

touch out.summary ;
touch out.noclass ;
touch out.tooshort ;
touch out.001.fasta ;
touch out.log ;
touch out.marker ;
touch out.abund1 ;

#if $output.plotmarker
printf "%s\n" "%PDF-1.4" "%%EOF" > out.marker.pdf ;
#end if

mkdir empty_markers ;
tar -czf out.marker_of_each_bin.tar.gz empty_markers ;

#if $assembly.inputs.type == 'reads'
#if $assembly.inputs.reassembly != ""
mkdir -p out.reassem ;
touch out.reassem/out.001.fasta ;
touch out.reassem/out.reads.001 ;
touch out.reassem/out.reads.noclass ;
touch out.reassem/N50.txt ;
#end if
#end if

run_MaxBin.pl
-contig '$contig'
-out out
#if $assembly.inputs.type == 'reads':
-reads_list reads_list
$assembly.inputs.reassembly
#else if $assembly.inputs.type == 'abund':
-abund_list abund_list
#end if
-min_contig_length $adv.min_contig_length
-max_iteration $adv.max_iteration
-prob_threshold $adv.prob_threshold
$output.plotmarker
-markerset $output.markerset
-thread \${GALAXY_SLOTS:-1}
gzip -cd out.marker_of_each_bin.tar.gz | tar -xf - ;
exit 0 ;

&& gzip -cd out.marker_of_each_bin.tar.gz | tar -xf -
fi
))
&& cat maxbin.stdout
&& cat maxbin.stderr >&2
&& gzip -cd out.marker_of_each_bin.tar.gz | tar -xf -

## redirect the idba out and err file content to stdout and err
## since this is also wanted in case the error case ';' is used here to
## separate commands
#if $assembly.inputs.type == 'reads' and $assembly.inputs.reassembly != ""
; echo "==== IDBA stdout ===="
&& if [[ -f out.idba.out ]]; then cat out.idba.out; fi
&& echo "==== IDBA stderr ====" 1>&2
&& if [[ -f out.idba.err ]]; then cat out.idba.err 1>&2; fi
#end if
## redirect the idba out and err file content to stdout and err
## since this is also wanted in case the error case ';' is used here to
## separate commands
#if $assembly.inputs.type == 'reads' and $assembly.inputs.reassembly != ""
; echo "==== IDBA stdout ===="
&& if [[ -f out.idba.out ]]; then cat out.idba.out; fi
&& echo "==== IDBA stderr ====" 1>&2
&& if [[ -f out.idba.err ]]; then cat out.idba.err 1>&2; fi
#end if
]]></command>
<inputs>
<expand macro="contig"/>
Expand Down Expand Up @@ -200,7 +238,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="interleavedPE_unmapped_Sample3_small.fasta" ftype="fasta"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand All @@ -209,7 +247,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value=""/>
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand All @@ -232,7 +270,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="interleavedPE_unmapped_Sample3_small.fasta,interleavedPE_unmapped_Sample3_small.fasta" ftype="fasta"/>
<param name="output_abundances" value="true"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand Down Expand Up @@ -289,7 +327,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.95"/>
</section>
<section name="output">
<param name="plotmarker" value="-plotmarker"/>
<param name="plotmarker" value="true"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand All @@ -313,7 +351,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="interleavedPE_unmapped_Sample3_small.fasta" ftype="fasta"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value="-reassembly"/>
<param name="reassembly" value="true"/>
</conditional>
</conditional>
<section name="adv">
Expand All @@ -322,7 +360,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value=""/>
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand Down Expand Up @@ -371,7 +409,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="test4_reads.fastqsanger" ftype="fastqsanger"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand All @@ -380,7 +418,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value=""/>
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand All @@ -403,7 +441,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="test4_reads 2.fastqsanger" ftype="fastqsanger"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand All @@ -412,7 +450,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value=""/>
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand All @@ -435,7 +473,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="test4_reads.fastqsanger.gz" ftype="fastqsanger.gz"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand All @@ -444,7 +482,7 @@ run_MaxBin.pl
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value=""/>
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
Expand All @@ -467,7 +505,7 @@ run_MaxBin.pl
<param name="type" value="reads"/>
<param name="reads" value="test4_reads.fastqsanger.gz,test4_reads.fastqsanger.gz" ftype="fasta"/>
<param name="output_abundances" value="true"/>
<param name="reassembly" value=""/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
Expand Down Expand Up @@ -517,6 +555,52 @@ run_MaxBin.pl
</element>
</output_collection>
</test>
<test expect_num_outputs="4">
<param name="contig" value="Bin_Sample3_contigs.fasta" ftype="fasta" />
<conditional name="assembly">
<param name="type" value="individual"/>
<conditional name="inputs">
<param name="type" value="reads"/>
<param name="reads" value="interleavedPE_unmapped_Sample3_small.fasta" ftype="fasta"/>
<param name="output_abundances" value="false"/>
<param name="reassembly" value="false"/>
</conditional>
</conditional>
<section name="adv">
<param name="min_contig_length" value="10000"/>
<param name="max_iteration" value="50"/>
<param name="prob_threshold" value="0.5"/>
</section>
<section name="output">
<param name="plotmarker" value="false"/>
<param name="marker" value="false"/>
<param name="markers" value="false" />
<param name="log" value="false"/>
<param name="markerset" value="107"/>
</section>
<output_collection name="bins" type="list" count="1">
<element name="001" ftype="fasta">
<assert_contents>
<has_size value="0"/>
</assert_contents>
</element>
</output_collection>
<output name="summary" ftype="tabular">
<assert_contents>
<has_size value="0"/>
</assert_contents>
</output>
<output name="noclass" ftype="fasta">
<assert_contents>
<has_size value="0"/>
</assert_contents>
</output>
<output name="toshort" ftype="fasta">
<assert_contents>
<has_size value="704488"/>
</assert_contents>
</output>
</test>
</tests>
<help><![CDATA[
MaxBin is a software that clusters metagenomic contigs into different bins,
Expand Down
Loading