comparison recover_samples_discarded_by_subsample.xml @ 0:607c5e7e0a64 draft

planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/mycrobiota commit 1c4c58018b64ff3531a719e789ce71cb0a1244c5
author erasmus-medical-center
date Wed, 13 Dec 2017 10:09:50 -0500
parents
children e93e39c121b1
comparison
equal deleted inserted replaced
-1:000000000000 0:607c5e7e0a64
1 <tool id="mycrobiota_subsample_add_discarded_samples" name="Recover samples" version="0.1" profile="16.07">
2 <description> discarded by sub.sample</description>
3 <requirements>
4 <requirement type="package" version="1.36.1">mothur</requirement>
5 </requirements>
6 <command detect_errors="aggressive"><![CDATA[
7 ln -s "$in_fasta" fasta.dat &&
8 ln -s "$in_group" group.dat &&
9 ln -s "$in_fasta_subsampled" fasta2.dat &&
10 ln -s "$in_group_subsampled" group2.dat
11
12 ## mothur count.groups on in_fasta
13 && echo 'count.groups(group=group.dat)' | sed 's/ //g' | mothur
14
15 ## get group names with fewer than threshold reads and make a dash-separated list
16 && samples=`python -c "print('-'.join([g[0] for g in [ l.strip().split('\t') for l in open('group.count.summary').readlines() ] if int(g[1]) < $threshold]))"`
17
18 ## get.groups on in_fasta with this list of groups, if list not empty, otherwise create empty file
19 &&
20 if [ -z "\$samples"];
21 then
22 touch fasta.pick.dat;
23 touch group.pick.dat;
24 else
25 echo "get.groups(fasta=fasta.dat, group=group.dat, groups=\$samples)" | sed 's/ //g' | mothur;
26 fi
27
28 ## merge selected reads (fasta.pick.dat) with the fasta file from after sub.sample
29 && echo "merge.files(input=fasta2.dat-fasta.pick.dat, output=final_fasta)" | sed 's/ //g' | mothur
30
31 ## merge group files
32 && echo "merge.files(input=group2.dat-group.pick.dat, output=final_group)" | sed 's/ //g' | mothur
33
34 ]]></command>
35 <inputs>
36 <param name="in_fasta" type="data" format="fasta" label="Fasta before subsample"/>
37 <param name="in_fasta_subsampled" type="data" format="fasta" label="Fasta after subsample"/>
38 <param name="in_group" type="data" format="mothur.groups" label="Group file before subsample"/>
39 <param name="in_group_subsampled" type="data" format="mothur.groups" label="Group file after subsample"/>
40 <param name="threshold" type="integer" value="" min="0" label="Subsample level - cutoff value used in the subsampling" help="any samples with fewer reads than this value would have been discarded by sub.sample, but we want to add them back in" />
41 </inputs>
42 <outputs>
43 <data name="out_fasta" format="fasta" from_work_dir="final_fasta" label="${tool.name} on ${on_string}: fasta"/>
44 <data name="out_group" format="mothur.groups" from_work_dir="final_group" label="${tool.name} on ${on_string}: group"/>
45 </outputs>
46 <tests>
47 <test>
48 <param name="in_fasta" value="fasta_before_subsample_small.fasta" ftype="fasta"/>
49 <param name="in_fasta_subsampled" value="fasta_after_subsample_small.fasta" ftype="fasta"/>
50 <param name="in_group" value="groups_before_subsample_small.groups" ftype="mothur.groups"/>
51 <param name="in_group_subsampled" value="groups_after_subsample_small.groups" ftype="mothur.groups"/>
52 <param name="threshold" value="3"/>
53 <output name="out_fasta" file="recovered.fasta"/>
54 <output name="out_group" file="recovered.groups"/>
55 </test>
56 </tests>
57 <help><![CDATA[
58 **What it does**
59 filter fasta file by group based on number of sequences in the group.
60 ]]></help>
61 <citations>
62 </citations>
63 </tool>