# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/JinyuanSun/CMPP/blob/main/ColabCMPP.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + id="OC4T3XzqzOA8" cellView="form"
#@title Install software

#@markdown blastp, hmmscan, and additional databases will 
#@markdown be downloaded into Colab space.
# %%capture
# %%bash
pip install venn
git clone https://github.com/JinyuanSun/CMPP.git
# mv CMPP/* ./
wget http://wulab.cf/CMPP/funcational.tar.gz
tar vczf functional.tar.gz
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.12.0+-x64-linux.tar.gz
tar vxzf ncbi-blast-2.12.0+-x64-linux.tar.gz
wget http://172.16.58.3/CMPP/functional.tar.gz
tar vxzf functional.tar.gz
apt install hmmer 
# cp ncbi-blast-2.12.0+/bin/* /usr/bin
# rm *tar.gz


# + id="CYOIsyci8_tT" cellView="form"
#@title Upload or Download proteins in fasta format

#@markdown Once this cell has been executed, upload your fasta file.

from google.colab import files

uploaded = files.upload()
uploaded = list(uploaded.keys())[0]
import os
os.system("mv " + uploaded + " protein.faa")



# + cellView="form" id="W7DytVs2Xfww"
# %%capture
#@title Or download proteins from NCBI directly.
Fasta_File_Url = 'https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/732/125/GCF_000732125.1_ScApio1.0/GCF_000732125.1_ScApio1.0_protein.faa.gz' #@param {type:"string"}
import requests
image_url = Fasta_File_Url
r = requests.get(image_url) 
with open("protein.faa.gz",'wb') as f:
    f.write(r.content)
# !gunzip protein.faa.gz
# !touch FASTA_READY

# + id="Zo5kdzUrzesT" colab={"base_uri": "https://localhost:8080/"} cellView="form" outputId="14ae4754-0d88-46ed-92a2-aa2c5eee6d78"
#@title Run CMPP

# %%bash
if [ -d "CMPP_out" ]; then
 rm -rf CMPP_out
fi

./run_CMPP_anno.sh -i protein.faa -d functional
zip -FSr CMPP_out.zip CMPP_out

# + cellView="form" id="OQTYju3RLsLj"
#@title Download results!
files.download('CMPP_out.zip') 

StarcoderdataJupyterScriptsDedupFiltered