{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# What is about ?\n\nThere are some problems to correctly install some protein language models on Kaggle.\n\nMay be someone can suggest how to resolve these problems ? \n\nSeqvec:  https://pypi.org/project/seqvec/\n\nbio_embeddings (many models in one package): https://github.com/sacdallago/bio_embeddings        \n        \nPS \n\n\nGood news: some models work on Kaggle: https://www.kaggle.com/code/wanko123/novoenzyme-protbert-embedding-eda ,\nsearch for more in \"Enzymes\" Kaggle challenge: https://www.kaggle.com/competitions/novozymes-enzyme-stability-prediction\nor more general search on Kaggle for \"protein language model\" : https://www.kaggle.com/search?q=protein+language+model\n\nSee : https://www.kaggle.com/alexandervc/protbert-embedding-starter - based on the first notebook above. \n","metadata":{}},{"cell_type":"markdown","source":"# Seqvec ","metadata":{}},{"cell_type":"code","source":"!pip install seqvec","metadata":{"execution":{"iopub.status.busy":"2023-04-22T11:30:33.432792Z","iopub.execute_input":"2023-04-22T11:30:33.433236Z","iopub.status.idle":"2023-04-22T11:33:36.214555Z","shell.execute_reply.started":"2023-04-22T11:30:33.433196Z","shell.execute_reply":"2023-04-22T11:33:36.213109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip show seqvec","metadata":{"execution":{"iopub.status.busy":"2023-04-22T11:51:43.575148Z","iopub.execute_input":"2023-04-22T11:51:43.577899Z","iopub.status.idle":"2023-04-22T11:51:54.838253Z","shell.execute_reply.started":"2023-04-22T11:51:43.5778Z","shell.execute_reply":"2023-04-22T11:51:54.836706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from seqvec import SeqVecModel","metadata":{"execution":{"iopub.status.busy":"2023-04-22T11:38:29.105472Z","iopub.execute_input":"2023-04-22T11:38:29.105949Z","iopub.status.idle":"2023-04-22T11:38:29.126097Z","shell.execute_reply.started":"2023-04-22T11:38:29.105912Z","shell.execute_reply":"2023-04-22T11:38:29.124165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from seqvec.model import SeqVecModel","metadata":{"execution":{"iopub.status.busy":"2023-04-22T11:38:34.442723Z","iopub.execute_input":"2023-04-22T11:38:34.443345Z","iopub.status.idle":"2023-04-22T11:38:34.46331Z","shell.execute_reply.started":"2023-04-22T11:38:34.443286Z","shell.execute_reply":"2023-04-22T11:38:34.461386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# bio-embeddings\n\nSee example: https://github.com/sacdallago/bio_embeddings/blob/develop/notebooks/embed_custom_sequence.ipynb\n\nAnd other notebooks in that directory: https://github.com/sacdallago/bio_embeddings/tree/develop/notebooks\n","metadata":{}},{"cell_type":"code","source":"!pip install bio-embeddings[all]","metadata":{"execution":{"iopub.status.busy":"2023-04-22T14:59:40.451046Z","iopub.execute_input":"2023-04-22T14:59:40.451572Z","iopub.status.idle":"2023-04-22T15:05:19.291165Z","shell.execute_reply.started":"2023-04-22T14:59:40.451533Z","shell.execute_reply":"2023-04-22T15:05:19.289162Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nfrom bio_embeddings.embed import SeqVecEmbedder, ProtTransBertBFDEmbedder","metadata":{"execution":{"iopub.status.busy":"2023-04-22T15:11:14.696579Z","iopub.execute_input":"2023-04-22T15:11:14.698552Z","iopub.status.idle":"2023-04-22T15:11:18.304766Z","shell.execute_reply.started":"2023-04-22T15:11:14.698486Z","shell.execute_reply":"2023-04-22T15:11:18.302028Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"embedders = []\nsequence = \"MALLHSARVLSGVASAFHPGLAAAASARASSWWAHVEMGPPDPILGVTEAYKRDTNSKKMNLGVGAYRDDNGKPYVLPSVRKAEAQIAAKGLDKEYLPIGGLAEFCRASAELALGENSEVVKSGRFVTVQTISGTGALRIGASFLQRFFKFSRDVFLPKPSWGNHTPIFRDAGMQLQSYRYYDPKTCGFDFTGALEDISKIPEQSVLLLHACAHNPTGVDPRPEQWKEIATVVKKRNLFAFFDMAYQGFASGDGDKDAWAVRHFIEQGINVCLCQSYAKNMGLYGERVGAFTVICKDADEAKRVESQLKILIRPMYSNPPIHGARIASTILTSPDLRKQWLQEVKGMADRIIGMRTQLVSNLKKEGSTHSWQHITDQIGMFCFTGLKPEQVERLTKEFSIYMTKDGRISVAGVTSGNVGYLAHAIHQVTK\"\nembedders.append(ProtTransBertBFDEmbedder())\nembedders.append(SeqVecEmbedder())","metadata":{"execution":{"iopub.status.busy":"2023-04-22T15:11:39.024825Z","iopub.execute_input":"2023-04-22T15:11:39.025319Z","iopub.status.idle":"2023-04-22T15:11:39.052238Z","shell.execute_reply.started":"2023-04-22T15:11:39.025275Z","shell.execute_reply":"2023-04-22T15:11:39.050247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip3 install -U pip > /dev/null\n!pip3 install -U bio_embeddings[all] > /dev/null","metadata":{"execution":{"iopub.status.busy":"2023-04-22T15:11:58.379849Z","iopub.execute_input":"2023-04-22T15:11:58.380393Z","iopub.status.idle":"2023-04-22T15:12:33.876309Z","shell.execute_reply.started":"2023-04-22T15:11:58.380341Z","shell.execute_reply":"2023-04-22T15:12:33.874356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nfrom bio_embeddings.embed import SeqVecEmbedder, ProtTransBertBFDEmbedder","metadata":{"execution":{"iopub.status.busy":"2023-04-22T15:13:02.510383Z","iopub.execute_input":"2023-04-22T15:13:02.51098Z","iopub.status.idle":"2023-04-22T15:13:02.608877Z","shell.execute_reply.started":"2023-04-22T15:13:02.510908Z","shell.execute_reply":"2023-04-22T15:13:02.606891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}