如何使用Conda在Google Colab中为antiSMASH创建虚拟环境?

时间:2020-06-16 23:49:51

标签: ubuntu conda google-colaboratory bioinformatics virtual-environment

我想在Google Colab中使用antiSMASH(https://docs.antismash.secondarymetabolites.org/)。如何设置并运行示例?

1 个答案:

答案 0 :(得分:2)

您必须首先安装Anaconda。

以下命令将创建一个虚拟环境并将antiSMASH安装到其中:

%%shell
eval "$(conda shell.bash hook)" # copy conda command to shell

# Create virtual environment for antiSMASH, then install dependencies, antiSMASH, and databases into it (this will take a while)
conda create --prefix /usr/local/envs/antismash antismash -y
conda activate antismash

# Download antiSMASH databases and check that everything was installed properly
download-antismash-databases
antismash --check-prereqs
conda deactivate

下载样本基因组以测试antiSMASH

accession = 'NC_013216'
antismash_path = '/usr/local/envs/antismash'
output_string = '%s/output/%s.gbk'%(antismash_path, accession.strip())

handle = Entrez.efetch(db="nucleotide", id=accession, rettype="gbwithparts", retmode="text")
print('Download of %s successful'%(accession.strip()))
print('Reading ' + output_string + '...')
record_string = handle.read()
with open(output_string, 'w') as record_writer:
    record_writer.write(record_string)
print('Saved as: ' + output_string)

使用antiSMASH处理样品基因组

%%shell
eval "$(conda shell.bash hook)" # copy conda command to shell

conda activate antismash

echo "Processing with antiSMASH..."
antismash /usr/local/envs/antismash/output/NC_013216.gbk \
  --output-dir /usr/local/envs/antismash/output/NC_013216

conda deactivate