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

How do I create a virtual environment for antiSMASH in Google Colab using Conda?

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

您必须先安装 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