#环境很重要!!!!!!!!!!!!!
conda create -n metaMIC
conda activate metaMIC
mamba install python=3.8
mamba install -c conda-forge pandas=1.4.4
mamba install -c conda-forge numpy=1.19.5
pip install pysam==0.22.1
mamba install scikit-learn=0.22.0 joblib requests
mamba install -c conda-forge biopython=1.78
mamba install -c bioconda samtools=1.9 bwa=0.7.17 jellyfish
git clone https://github.com/ZhaoXM-Lab/metaMIC.git
cd metaMIC
python setup.py install
metaMIC -h
# downloading models
metaMIC download_model
#我这样下载失败了
#根据源代码提示https://github.com/ZhaoXM-Lab/metaMIC/blob/main/metaMIC/metaMIC.py
#手动到下面的网页下载文件
mkdir model
cd model
#md5 0c759a28d0ba3490eeba098395c88586
https://zenodo.org/record/5768805/files/metaSPAdes.tar.gz
#md5 9f6835d3033a177055343ecaa78889bc
https://zenodo.org/record/4781819/files/IDBA_UD.tar.gz
#md5 da9038af3582eea04288775a72003e6b
https://zenodo.org/record/4781819/files/MEGAHIT.tar.gz
#检查文件完整性
md5sum 上面的每个文件
#解压缩
tar -xzvf metaSPAdes.tar.gz
tar -xzvf IDBA_UD.tar.gz
tar -xzvf MEGAHIT.tar.gz
#把解压后文件夹移动到mamba环境中的文件夹
~/mambaforge/envs/metaMIC/lib/python3.8/site-packages/metaMIC-0.0.0-py3.8.egg/metaMIC/model/
#解压每个文件夹里面的pkl.gz
gunzip *
使用
software="/home/zhongpei/hard_disk_sda2/zhongpei/Software"
assembly="/home/zhongpei/diarrhoea/xjs_FJ_metagenomic/assembly_result"
path=$(pwd)
mkdir metaMIC_contigs
#!/bin/bash
source /home/zhongpei/miniconda3/bin/activate metaMIC
cd ${assembly}
for i in *_megahit_contigs.fa
do
num=${i%%_megahit_contigs.fa}
cd ${path}
${software}/bwa-mem2/bwa-mem2 index ${assembly}/${i}
${software}/bwa-mem2/bwa-mem2 mem -a -t 180 ${assembly}/${i} ${num}_clean_1.fastq.gz ${num}_clean_2.fastq.gz > ${num}_aligen.sam
samtools view -h -q 10 -m 50 -F 4 -b -@ 180 ${num}_aligen.sam | samtools sort -@ 180 > ${num}_mem2.bam
samtools mpileup -C 50 -A -f ${i} ${num}_mem2.bam | awk '$3 != "N"' > ${num}_pileup_file
rm *.fa.*
rm ${num}_aligen.sam
metaMIC extract_feature --bam ${num}_mem2.bam -c ${assembly}/${i} -o ${num}_metaMIC --pileup ${num}_pileup_file -m meta -t 180
metaMIC predict -c ${assembly}/${i} -o ${num}_metaMIC -a MEGAHIT -m meta
cd ${num}_metaMIC
mv metaMIC_corrected_contigs.fa ${path}/metaMIC_contigs/${num}_metaMIC.fa
cd ${path}
#rm -rf ${num}_metaMIC
rm ${num}_mem2.bam
#rm ${num}_pileup_file
cd assembly
done
conda deactivate
conda deactivate