sudo apt install -y build-essential
# Check required tools
nextflow -version # Otherwise install Nextflow: https://www.nextflow.io/
conda --version # Otherwise install Miniconda: https://www.nextflow.io/
g++ --version # Otherwise install the compiler, "sudo apt install build-essential" from ubuntu
# Install mamba
conda install -y -c conda-forge mamba
# Download the repository
git clone --branch dev https://github.com/MattiaPandolfoVR/MetaPhage.git
# IMPORTANT: Set the installation directory now or the following stesp won't work
export METAPHAGE_DIR="$PWD"/MetaPhage
# Create the environment (needed once)
mamba env create -n metaphage2 --file "$METAPHAGE_DIR"/deps/env-v2.yaml
# ⚠️ Activate the environment to use MetaPhage
conda activate metaphage2
# Update/download krona and quast datasets (note: quast might fail as they
# are updating URLs, it's not a problem)
ktUpdateTaxonomy.sh
quast-download-silva
quast-download-busco
# Clone and compile
git clone https://github.com/weizhongli/cdhit.git
cd cdhit
make MAX_SEQ=2000000
# Move binaries to the directory with MetaPhage binaries
mv cd-hit cd-hit-2d cd-hit-454 cd-hit-div cd-hit-est "$METAPHAGE_DIR"/bin/
cd ..
rm -rf cdhit
# Download up to 6 files simultaneously to "$METAPHAGE_DIR"/DB/ (default location)
# It's important to specify the database release 2022.1 as by default you will get the bundle for v1
"$METAPHAGE_DIR"/bin/python/db_manager.py -o "$METAPHAGE_DIR"/db/ -m 6 -r 2022.1
# Download and setup virsorter 2
virsorter setup --db-dir "$METAPHAGE_DIR"/db/virsorter/virsorter2 --jobs 4
At this point you can use MetaPhage v2 in a similar fashion thant MetaPhage v1:
If you want a step-by-step guidance, read on:
In the repository there is a folder with an example metadata-file (./demo/
), we can fetch its reads:
cd "$METAPHAGE_DIR"
./bin/getExample.py --verbose -t 8
See start new project for more details
Customise the output directory (-o
) and the temporary directory (--work
) as needed.
python ./bin/newProject.py \
-i demo \
-m demo/infant-metadata.csv \
-v Infant_delivery_type \
-o MetaPhage-Demo-Output \
--work /tmp \
-s demo.conf
# Skip metaquast
nextflow run main.nf -c demo.conf --skip_metaquast