Skip to content

Commit

Permalink
Merge pull request galaxyproject#5492 from mvdbeek/trinity_scratch_dir
Browse files Browse the repository at this point in the history
Simplify and fix trinity scratch dir handling
  • Loading branch information
mvdbeek authored Sep 20, 2023
2 parents c083399 + b36dbe6 commit ec26c47
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 34 deletions.
14 changes: 7 additions & 7 deletions tools/trinity/abundance_estimates_to_matrix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
</data>
</outputs>
<tests>
<test>
<test expect_num_outputs="3">
<param name="samples" ftype="tabular" value="count/rsem_bowtie/sample_A,count/rsem_bowtie/sample_B"/>
<param name="est_method" value="RSEM"/>
<param name="cross_sample_norm" value="TMM"/>
Expand All @@ -112,7 +112,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="3">
<param name="samples" ftype="tabular" value="count/rsem_bowtie2/sample_A,count/rsem_bowtie2/sample_B"/>
<param name="est_method" value="RSEM"/>
<param name="cross_sample_norm" value="TMM"/>
Expand All @@ -135,7 +135,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="3">
<param name="samples" ftype="tabular" value="count/express_bowtie/sample_A,count/express_bowtie/sample_B"/>
<param name="est_method" value="eXpress"/>
<param name="cross_sample_norm" value="TMM"/>
Expand All @@ -158,7 +158,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="3">
<param name="samples" ftype="tabular" value="count/rsem_bowtie/sample_A,count/rsem_bowtie/sample_B"/>
<param name="est_method" value="RSEM"/>
<param name="cross_sample_norm" value="UpperQuartile"/>
Expand All @@ -180,7 +180,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="2">
<param name="samples" ftype="tabular" value="count/rsem_bowtie/sample_A,count/rsem_bowtie/sample_B"/>
<param name="est_method" value="RSEM"/>
<param name="cross_sample_norm" value="none"/>
Expand All @@ -197,7 +197,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="2">
<param name="samples" ftype="tabular" value="count/salmon/sample_A,count/salmon/sample_B"/>
<param name="est_method" value="salmon"/>
<param name="cross_sample_norm" value="none"/>
Expand All @@ -214,7 +214,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="3">
<param name="samples" ftype="tabular" value="count/kallisto/abundance.tsv.genes,count/kallisto/abundance_B.tsv.genes"/>
<param name="est_method" value="kallisto"/>
<param name="cross_sample_norm" value="TMM"/>
Expand Down
8 changes: 4 additions & 4 deletions tools/trinity/align_and_estimate_abundance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
</data>
</outputs>
<tests>
<test>
<test expect_num_outputs="2">
<param name="paired_or_single" value="paired"/>
<param name="left_input" value="reads.left.fq.gz"/>
<param name="right_input" value="reads.right.fq.gz"/>
Expand All @@ -203,7 +203,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="2">
<param name="paired_or_single" value="paired"/>
<param name="left_input" value="reads.left.fq"/>
<param name="right_input" value="reads.right.fq"/>
Expand All @@ -226,7 +226,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="2">
<param name="paired_or_single" value="paired"/>
<param name="left_input" value="reads.left.fq"/>
<param name="right_input" value="reads.right.fq"/>
Expand All @@ -249,7 +249,7 @@
</assert_contents>
</output>
</test>
<test>
<test expect_num_outputs="2">
<param name="paired_or_single" value="paired"/>
<param name="left_input" value="reads.left.fq"/>
<param name="right_input" value="reads.right.fq"/>
Expand Down
6 changes: 3 additions & 3 deletions tools/trinity/analyze_diff_expr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</outputs>
<tests>
<!-- Test without GO enrichment analysis -->
<test>
<test expect_num_outputs="9">
<param name="matrix" value="count/qcheck/matrix.counts.matrix"/>
<param name="samples" value="count/samples.txt"/>
<param name="DE_results">
Expand Down Expand Up @@ -125,7 +125,7 @@
<output name="rdata" compare="sim_size" file="count/analyze_diff_expr/results.matrix.RData"/>
</test>
<!-- Test without GO enrichment analysis, test name of DE_results input files different from those generated by tool run_de_analysis.pl -->
<test>
<test expect_num_outputs="9">
<param name="matrix" value="count/qcheck/matrix.counts.matrix"/>
<param name="samples" value="count/samples.txt"/>
<param name="DE_results">
Expand Down Expand Up @@ -154,7 +154,7 @@
<output name="rdata" compare="sim_size" file="count/analyze_diff_expr/results.matrix.RData"/>
</test>
<!-- Test with GO enrichment analysis -->
<test>
<test expect_num_outputs="10">
<param name="matrix" value="count/qcheck/matrix.counts.matrix"/>
<param name="samples" value="count/samples.txt"/>
<param name="DE_results">
Expand Down
33 changes: 13 additions & 20 deletions tools/trinity/trinity.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="trinity" name="Trinity" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
<tool id="trinity" name="Trinity" version="@TOOL_VERSION@+galaxy1" profile="21.05">
<description>de novo assembly of RNA-Seq data</description>
<macros>
<import>macros.xml</import>
Expand All @@ -14,12 +14,11 @@
GALAXY_MEMORY_GB=\$((GALAXY_MEMORY_MB / 1024)) ;
fi ;
if [ ! -z "\$TRINITY_SCRATCH_DIR" ] ; then
workdir=`pwd` ;
scratchfolder=\$(mktemp -d -p "\$TRINITY_SCRATCH_DIR");
emptyfolder=\$(mktemp -d -p "\$TRINITY_SCRATCH_DIR");
cd "\$scratchfolder" ;
fi ;
TRINITY_SCRATCH_DIR=\${TRINITY_SCRATCH_DIR:-\${TMPDIR:-\$_GALAXY_JOB_TMP_DIR}}
workdir=\$(pwd)
scratchfolder=\$(mktemp -d -p "\$TRINITY_SCRATCH_DIR");
emptyfolder=\$(mktemp -d -p "\$TRINITY_SCRATCH_DIR");
cd "\$scratchfolder" ;
#if $additional_params.guided.is_guided == "yes":
ln -s '${$additional_params.guided.genome_guided_bam}' 'localbam.bam' &&
Expand Down Expand Up @@ -148,22 +147,16 @@
## CPU and butterfly options.
--CPU \${GALAXY_SLOTS:-4} --max_memory \${GALAXY_MEMORY_GB:-1}G --bflyHeapSpaceMax \${GALAXY_MEMORY_GB:-1}G --bfly_opts '-V 10 --stderr'
## > $trinity_log 2>&1
&&
## Trinity can create millions of files in the same directory, so the cleaning task makes use of rsync
## for ensuring better performances.
## see: https://web.archive.org/web/20130929001850/http://linuxnote.net/jianingy/en/linux/a-fast-way-to-remove-huge-number-of-files.html
if [ ! -z "\$TRINITY_SCRATCH_DIR" ] ; then
mkdir -p "\$workdir/trinity_out_dir";
cp -p trinity_out_dir/Trinity* "\$workdir/trinity_out_dir";
cd "\$TRINITY_SCRATCH_DIR";
rsync -a --delete "\$emptyfolder/" "\$scratchfolder/";
rmdir "\$emptyfolder" "\$scratchfolder/";
cd "\$workdir";
fi ;
rsync -a --delete "\$emptyfolder/" "\$scratchfolder/" --exclude=trinity_out_dir.Trinity.fasta --exclude=trinity_out_dir.Trinity.fasta.gene_trans_map;
mv "\$scratchfolder/trinity_out_dir.Trinity.fasta" '$assembled_transcripts';
mv "\$scratchfolder/trinity_out_dir.Trinity.fasta.gene_trans_map" '$gene_to_trans';
cd "\$workdir";
rmdir "\$emptyfolder" "\$scratchfolder"
]]></command>
<inputs>
<conditional name="pool">
Expand Down Expand Up @@ -235,8 +228,8 @@
</section>
</inputs>
<outputs>
<data name="assembled_transcripts" format="fasta" label="${tool.name} on ${on_string}: Assembled Transcripts" from_work_dir="trinity_out_dir.Trinity.fasta"/>
<data name="gene_to_trans" format="tabular" label="${tool.name} on ${on_string}: Gene to transcripts map" from_work_dir="trinity_out_dir.Trinity.fasta.gene_trans_map"/>
<data name="assembled_transcripts" format="fasta" label="${tool.name} on ${on_string}: Assembled Transcripts"/>
<data name="gene_to_trans" format="tabular" label="${tool.name} on ${on_string}: Gene to transcripts map"/>
</outputs>
<tests>
<test>
Expand Down

0 comments on commit ec26c47

Please sign in to comment.