-
Notifications
You must be signed in to change notification settings - Fork 43
Refine & reassemble bins with metaWRAP
Francisco Zorrilla edited this page Mar 22, 2021
·
2 revisions
The metaWRAP
module bin_refine
implemented in the Snakefile as follows:
rule binRefine:
input:
concoct = f'{config["path"]["root"]}/{config["folder"]["concoct"]}/{{IDs}}/{{IDs}}.concoct-bins',
metabat = f'{config["path"]["root"]}/{config["folder"]["metabat"]}/{{IDs}}/{{IDs}}.metabat-bins',
maxbin = f'{config["path"]["root"]}/{config["folder"]["maxbin"]}/{{IDs}}/{{IDs}}.maxbin-bins'
output:
directory(f'{config["path"]["root"]}/{config["folder"]["refined"]}/{{IDs}}')
benchmark:
f'{config["path"]["root"]}/benchmarks/{{IDs}}.binRefine.benchmark.txt'
shell:
"""
set +u;source activate {config[envs][metawrap]};set -u;
mkdir -p $(dirname {output})
mkdir -p {output}
cd $SCRATCHDIR
echo "Copying bins from CONCOCT, metabat2, and maxbin2 to $SCRATCHDIR ... "
cp -r {input.concoct} {input.metabat} {input.maxbin} $SCRATCHDIR
echo "Renaming bin folders to avoid errors with metaWRAP ... "
mv $(basename {input.concoct}) $(echo $(basename {input.concoct})|sed 's/-bins//g')
mv $(basename {input.metabat}) $(echo $(basename {input.metabat})|sed 's/-bins//g')
mv $(basename {input.maxbin}) $(echo $(basename {input.maxbin})|sed 's/-bins//g')
echo "Running metaWRAP bin refinement module ... "
metaWRAP bin_refinement -o . \
-A $(echo $(basename {input.concoct})|sed 's/-bins//g') \
-B $(echo $(basename {input.metabat})|sed 's/-bins//g') \
-C $(echo $(basename {input.maxbin})|sed 's/-bins//g') \
-t {config[cores][refine]} \
-m {config[params][refineMem]} \
-c {config[params][refineComp]} \
-x {config[params][refineCont]}
rm -r $(echo $(basename {input.concoct})|sed 's/-bins//g') $(echo $(basename {input.metabat})|sed 's/-bins//g') $(echo $(basename {input.maxbin})|sed 's/-bins//g') work_files
mv * {output}
"""
The metaWRAP
module bin_reassemble
is implemented as follows:
rule binReassemble:
input:
R1 = rules.qfilter.output.R1,
R2 = rules.qfilter.output.R2,
refinedBins = rules.binRefine.output
output:
directory(f'{config["path"]["root"]}/{config["folder"]["reassembled"]}/{{IDs}}')
benchmark:
f'{config["path"]["root"]}/benchmarks/{{IDs}}.binReassemble.benchmark.txt'
shell:
"""
set +u;source activate {config[envs][metawrap]};set -u;
mkdir -p $(dirname {output})
cp -r {input.refinedBins}/metawrap_*_bins {input.R1} {input.R2} $SCRATCHDIR
cd $SCRATCHDIR
echo "Running metaWRAP bin reassembly ... "
metaWRAP reassemble_bins -o $(basename {output}) \
-b metawrap_*_bins \
-1 $(basename {input.R1}) \
-2 $(basename {input.R2}) \
-t {config[cores][reassemble]} \
-m {config[params][reassembleMem]} \
-c {config[params][reassembleComp]} \
-x {config[params][reassembleCont]} \
--parallel
rm -r metawrap_*_bins
rm -r $(basename {output})/work_files
rm *.fastq.gz
mv * $(dirname {output})
"""
- Quality filter reads with fastp
- Assembly with megahit
- Draft bin sets with CONCOCT, MaxBin2, and MetaBAT2
- Refine & reassemble bins with metaWRAP
- Taxonomic assignment with GTDB-tk
- Relative abundances with bwa
- Reconstruct & evaluate genome-scale metabolic models with CarveMe and memote
- Species metabolic coupling analysis with SMETANA