{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "#AlphaFold - single sequence input\n"
      ],
      "metadata": {
        "id": "VpfCw7IzVHXv"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# @title CODE\n",
        "import os\n",
        "import sys\n",
        "import re\n",
        "import time\n",
        "import numpy as np\n",
        "import matplotlib.pyplot as plt\n",
        "import pandas as pd\n",
        "from typing import List, Dict, Tuple, Optional\n",
        "from dataclasses import dataclass\n",
        "import tqdm.notebook\n",
        "\n",
        "# Configuration\n",
        "TQDM_BAR_FORMAT = '{l_bar}{bar}| {n_fmt}/{total_fmt} [elapsed: {elapsed} remaining: {remaining}]'\n",
        "\n",
        "@dataclass\n",
        "class FoldingResult:\n",
        "    \"\"\"Data class to store folding results\"\"\"\n",
        "    sequence: str\n",
        "    length: int\n",
        "    recycles: int\n",
        "    mean_plddt: float\n",
        "    min_plddt: float\n",
        "    max_plddt: float\n",
        "    mean_pae: float\n",
        "    final_positions: np.ndarray\n",
        "    plddt_scores: np.ndarray\n",
        "    pae_matrix: np.ndarray\n",
        "    execution_time: float\n",
        "\n",
        "class ColabFoldRunner:\n",
        "    \"\"\"Refactored ColabFold runner for batch processing\"\"\"\n",
        "\n",
        "    def __init__(self, verbose: bool = True):\n",
        "        self.verbose = verbose\n",
        "        self.setup_done = False\n",
        "\n",
        "        # Model components\n",
        "        self.model_runner = None\n",
        "        self.model_params = None\n",
        "\n",
        "        # Current model state\n",
        "        self.current_max_length = 0\n",
        "        self.runner_fn = None\n",
        "\n",
        "        # Sequence processing cache\n",
        "        self.current_sequence = \"\"\n",
        "        self.sequence_cache = None\n",
        "\n",
        "    def _print(self, *args, **kwargs):\n",
        "        \"\"\"Print only if verbose mode is enabled\"\"\"\n",
        "        if self.verbose:\n",
        "            print(*args, **kwargs)\n",
        "\n",
        "    def setup_environment(self):\n",
        "        \"\"\"Setup the environment and download required files\"\"\"\n",
        "        if self.setup_done:\n",
        "            return\n",
        "\n",
        "        self._print(\"Setting up ColabFold environment...\")\n",
        "\n",
        "        # Download and setup ColabFold if not already done\n",
        "        if not os.path.isdir(\"params\"):\n",
        "            os.system(\"wget -qnc https://raw.githubusercontent.com/sokrypton/ColabFold/main/beta/colabfold.py\")\n",
        "            self._print(\"Installing ColabDesign...\")\n",
        "            os.system(\"(mkdir params; apt-get install aria2 -qq; \\\n",
        "            aria2c -q -x 16 https://storage.googleapis.com/alphafold/alphafold_params_2021-07-14.tar; \\\n",
        "            tar -xf alphafold_params_2021-07-14.tar -C params; \\\n",
        "            touch params/done.txt)&\")\n",
        "\n",
        "            os.system(\"pip -q install git+https://github.com/sokrypton/ColabDesign.git@beta\")\n",
        "            os.system(\"ln -s /usr/local/lib/python3.*/dist-packages/colabdesign colabdesign\")\n",
        "\n",
        "            # Wait for params download\n",
        "            if not os.path.isfile(\"params/done.txt\"):\n",
        "                self._print(\"Downloading AlphaFold params...\")\n",
        "                while not os.path.isfile(\"params/done.txt\"):\n",
        "                    time.sleep(5)\n",
        "\n",
        "        # Import libraries after installation\n",
        "        import jax\n",
        "        import jax.numpy as jnp\n",
        "        from colabdesign.af.loss import get_plddt, get_pae\n",
        "        from colabdesign.af.prep import prep_input_features\n",
        "        from colabdesign.af.inputs import update_seq, update_aatype\n",
        "        from colabdesign.af.alphafold.common import protein\n",
        "        from colabdesign.af.alphafold.model import data, config, model\n",
        "        from colabdesign.af.alphafold.common import residue_constants\n",
        "        from colabdesign.rf.utils import make_animation\n",
        "        import py3Dmol\n",
        "        import colabfold as cf\n",
        "\n",
        "        # Store imports as globals for use in other methods\n",
        "        globals()['jax'] = jax\n",
        "        globals()['jnp'] = jnp\n",
        "        globals()['get_plddt'] = get_plddt\n",
        "        globals()['get_pae'] = get_pae\n",
        "        globals()['prep_input_features'] = prep_input_features\n",
        "        globals()['update_seq'] = update_seq\n",
        "        globals()['update_aatype'] = update_aatype\n",
        "        globals()['protein'] = protein\n",
        "        globals()['data'] = data\n",
        "        globals()['config'] = config\n",
        "        globals()['model'] = model\n",
        "        globals()['residue_constants'] = residue_constants\n",
        "        globals()['cf'] = cf\n",
        "\n",
        "        # Configure device\n",
        "        if int(jax.__version__.split(\".\")[1]) > 3:\n",
        "            os.environ[\"XLA_FLAGS\"] = \"--xla_gpu_enable_triton_gemm=false\"\n",
        "\n",
        "        try:\n",
        "            import jax.tools.colab_tpu\n",
        "            jax.tools.colab_tpu.setup_tpu()\n",
        "            self._print('Running on TPU')\n",
        "        except:\n",
        "            if jax.local_devices()[0].platform == 'cpu':\n",
        "                self._print(\"WARNING: no GPU detected, will be using CPU\")\n",
        "            else:\n",
        "                self._print('Running on GPU')\n",
        "\n",
        "        # Setup model configuration\n",
        "        cfg = config.model_config(\"model_5_ptm\")\n",
        "        cfg.model.num_recycle = 0\n",
        "        cfg.model.global_config.subbatch_size = None\n",
        "\n",
        "        model_name = \"model_2_ptm\"\n",
        "        self.model_params = data.get_model_haiku_params(\n",
        "            model_name=model_name, data_dir=\".\", fuse=True\n",
        "        )\n",
        "        self.model_runner = model.RunModel(cfg, self.model_params)\n",
        "\n",
        "        self.setup_done = True\n",
        "\n",
        "    def _process_sequence(self, sequence: str) -> Tuple[str, str, List[int], int]:\n",
        "        \"\"\"Process and validate input sequence\"\"\"\n",
        "        # Clean sequence - remove non-standard characters but keep chain separators\n",
        "        clean_seq = re.sub(r\"[^A-Z/:]+\", \"\", sequence.upper())\n",
        "\n",
        "        # Calculate chain breaks (positions where chains end)\n",
        "        chains = clean_seq.replace(\":\", \"/\").split(\"/\")\n",
        "        chain_lengths = [len(chain) for chain in chains]\n",
        "\n",
        "        # Final sequence with only amino acids\n",
        "        final_seq = re.sub(r\"[^A-Z]+\", \"\", clean_seq)\n",
        "        length = len(final_seq)\n",
        "\n",
        "        if length == 0:\n",
        "            raise ValueError(\"Empty sequence after cleaning\")\n",
        "\n",
        "        return clean_seq, final_seq, chain_lengths, length\n",
        "\n",
        "    def _ensure_model_capacity(self, required_length: int):\n",
        "        \"\"\"Ensure model can handle sequences of required length\"\"\"\n",
        "        if required_length > self.current_max_length:\n",
        "            new_max_length = required_length + 10  # Add padding\n",
        "            self._setup_model_for_length(new_max_length)\n",
        "\n",
        "    def _setup_model_for_length(self, max_length: int):\n",
        "        \"\"\"Setup JAX-compiled model runner for specific max length\"\"\"\n",
        "        self._print(f\"Setting up model for max length: {max_length}\")\n",
        "\n",
        "        def runner(inputs_dict):\n",
        "            \"\"\"Inner function that will be JIT compiled\"\"\"\n",
        "            # Unpack inputs\n",
        "            inputs = inputs_dict[\"inputs\"]\n",
        "            prev_state = inputs_dict[\"prev\"]\n",
        "            seq = inputs_dict[\"seq\"]\n",
        "            length = inputs_dict[\"length\"]\n",
        "\n",
        "            # Update inputs with current sequence\n",
        "            inputs[\"prev\"] = prev_state\n",
        "\n",
        "            # Convert sequence to one-hot encoding\n",
        "            seq_oh = jax.nn.one_hot(seq, 20)[None]\n",
        "            update_seq(seq_oh, inputs)\n",
        "            update_aatype(seq_oh, inputs)\n",
        "\n",
        "            # Create mask for actual sequence length\n",
        "            mask = jnp.arange(inputs[\"residue_index\"].shape[0]) < length\n",
        "            inputs[\"seq_mask\"] = inputs[\"seq_mask\"].at[:].set(mask)\n",
        "            inputs[\"msa_mask\"] = inputs[\"msa_mask\"].at[:].set(mask)\n",
        "            inputs[\"residue_index\"] = jnp.where(mask, inputs[\"residue_index\"], 0)\n",
        "\n",
        "            # Run prediction\n",
        "            key = jax.random.PRNGKey(0)\n",
        "            outputs = self.model_runner.apply(inputs_dict[\"params\"], key, inputs)\n",
        "\n",
        "            # Extract relevant outputs\n",
        "            return {\n",
        "                \"final_atom_positions\": outputs[\"structure_module\"][\"final_atom_positions\"],\n",
        "                \"final_atom_mask\": outputs[\"structure_module\"][\"final_atom_mask\"],\n",
        "                \"plddt\": get_plddt(outputs),\n",
        "                \"pae\": get_pae(outputs),\n",
        "                \"prev\": outputs[\"prev\"],\n",
        "                \"residue_idx\": inputs[\"residue_index\"]\n",
        "            }\n",
        "\n",
        "        # Compile the runner\n",
        "        self.runner_fn = jax.jit(runner)\n",
        "        self.current_max_length = max_length\n",
        "\n",
        "    def _prepare_inputs(self, sequence: str, chain_lengths: List[int], max_length: int) -> Dict:\n",
        "        \"\"\"Prepare input features for the model\"\"\"\n",
        "        # Convert sequence to integer array\n",
        "        seq_array = np.array([\n",
        "            residue_constants.restype_order.get(aa, 0)\n",
        "            for aa in sequence\n",
        "        ])\n",
        "        # Pad to max_length\n",
        "        seq_padded = np.pad(seq_array, [0, max_length - len(sequence)], constant_values=-1)\n",
        "\n",
        "        # Create fresh input features for this length\n",
        "        inputs = prep_input_features(max_length)\n",
        "        inputs[\"use_dropout\"] = False\n",
        "\n",
        "        # Set chain break indices\n",
        "        inputs['residue_index'][:] = cf.chain_break(\n",
        "            np.arange(max_length), chain_lengths, length=32\n",
        "        )\n",
        "\n",
        "        # Create input dictionary\n",
        "        return {\n",
        "            \"inputs\": inputs,\n",
        "            \"params\": self.model_params,\n",
        "            \"seq\": seq_padded,\n",
        "            \"length\": len(sequence),\n",
        "            \"prev\": {\n",
        "                'prev_msa_first_row': np.zeros([max_length, 256]),\n",
        "                'prev_pair': np.zeros([max_length, max_length, 128]),\n",
        "                'prev_pos': np.zeros([max_length, 37, 3])\n",
        "            }\n",
        "        }\n",
        "\n",
        "    def save_pdb(self, outputs: Dict, sequence_length: int, filename: str):\n",
        "        \"\"\"Save PDB coordinates\"\"\"\n",
        "        pdb_data = {\n",
        "            \"residue_index\": outputs[\"residue_idx\"][:sequence_length] + 1,\n",
        "            \"aatype\": outputs[\"seq\"][:sequence_length],\n",
        "            \"atom_positions\": outputs[\"final_atom_positions\"][:sequence_length],\n",
        "            \"atom_mask\": outputs[\"final_atom_mask\"][:sequence_length],\n",
        "            \"plddt\": outputs[\"plddt\"][:sequence_length]\n",
        "        }\n",
        "\n",
        "        b_factors = 100 * pdb_data[\"plddt\"][:, None] * pdb_data[\"atom_mask\"]\n",
        "        protein_obj = protein.Protein(\n",
        "            atom_positions=pdb_data[\"atom_positions\"],\n",
        "            atom_mask=pdb_data[\"atom_mask\"],\n",
        "            aatype=pdb_data[\"aatype\"],\n",
        "            residue_index=pdb_data[\"residue_index\"],\n",
        "            b_factors=b_factors\n",
        "        )\n",
        "\n",
        "        pdb_lines = protein.to_pdb(protein_obj)\n",
        "        with open(filename, 'w') as f:\n",
        "            f.write(pdb_lines)\n",
        "\n",
        "    def fold_sequence(self, sequence: str, recycles: int = 0, save_pdb_file: Optional[str] = None) -> FoldingResult:\n",
        "        \"\"\"Fold a single sequence and return results\"\"\"\n",
        "        start_time = time.time()\n",
        "\n",
        "        # Process and validate sequence\n",
        "        clean_seq, final_seq, chain_lengths, length = self._process_sequence(sequence)\n",
        "\n",
        "        # Ensure model can handle this sequence length\n",
        "        self._ensure_model_capacity(length)\n",
        "\n",
        "        # Check if we need to reprocess this sequence\n",
        "        if clean_seq != self.current_sequence:\n",
        "            self._print(f\"Processing new sequence (L={length})\")\n",
        "\n",
        "            # Prepare model inputs\n",
        "            model_inputs = self._prepare_inputs(final_seq, chain_lengths, self.current_max_length)\n",
        "\n",
        "            # Initialize storage for this sequence\n",
        "            self.sequence_cache = {\n",
        "                \"sequence\": clean_seq,\n",
        "                \"final_seq\": final_seq,\n",
        "                \"length\": length,\n",
        "                \"model_inputs\": model_inputs,\n",
        "                \"positions\": [],\n",
        "                \"plddts\": [],\n",
        "                \"paes\": [],\n",
        "                \"outputs\": []\n",
        "            }\n",
        "            self.current_sequence = clean_seq\n",
        "\n",
        "        # Get cached data\n",
        "        cache = self.sequence_cache\n",
        "\n",
        "        # Run additional recycles if needed\n",
        "        current_recycles = len(cache[\"outputs\"])\n",
        "\n",
        "        if self.verbose and recycles >= current_recycles:\n",
        "            progress_bar = tqdm.notebook.tqdm(\n",
        "                total=recycles + 1 - current_recycles,\n",
        "                bar_format=TQDM_BAR_FORMAT,\n",
        "                desc=f\"Folding (L={length}, cycles {current_recycles}->{recycles})\"\n",
        "            )\n",
        "        else:\n",
        "            progress_bar = None\n",
        "\n",
        "        # Run folding for required recycles\n",
        "        for cycle in range(current_recycles, recycles + 1):\n",
        "            # Run model\n",
        "            outputs = self.runner_fn(cache[\"model_inputs\"])\n",
        "            outputs = jax.tree_util.tree_map(lambda x: np.asarray(x), outputs)\n",
        "\n",
        "            # Store results (only the actual sequence length)\n",
        "            cache[\"positions\"].append(outputs[\"final_atom_positions\"][:length])\n",
        "            cache[\"plddts\"].append(outputs[\"plddt\"][:length])\n",
        "            cache[\"paes\"].append(outputs[\"pae\"][:length, :length])\n",
        "            cache[\"outputs\"].append(outputs)\n",
        "\n",
        "            # Update previous state for next cycle\n",
        "            cache[\"model_inputs\"][\"prev\"] = outputs[\"prev\"]\n",
        "\n",
        "            if progress_bar:\n",
        "                progress_bar.update(1)\n",
        "\n",
        "        if progress_bar:\n",
        "            progress_bar.close()\n",
        "\n",
        "        # Get final results\n",
        "        final_plddt = cache[\"plddts\"][recycles]\n",
        "        final_pae = cache[\"paes\"][recycles]\n",
        "        final_output = cache[\"outputs\"][recycles]\n",
        "\n",
        "        # Calculate statistics\n",
        "        mean_plddt = float(np.mean(final_plddt))\n",
        "        min_plddt = float(np.min(final_plddt))\n",
        "        max_plddt = float(np.max(final_plddt))\n",
        "        mean_pae = float(np.mean(final_pae))\n",
        "\n",
        "        execution_time = time.time() - start_time\n",
        "\n",
        "        # Save PDB if requested\n",
        "        if save_pdb_file:\n",
        "            # Add sequence info to outputs for PDB saving\n",
        "            final_output_for_pdb = final_output.copy()\n",
        "            final_output_for_pdb[\"seq\"] = cache[\"model_inputs\"][\"seq\"]\n",
        "            self.save_pdb(final_output_for_pdb, length, save_pdb_file)\n",
        "\n",
        "        return FoldingResult(\n",
        "            sequence=final_seq,\n",
        "            length=length,\n",
        "            recycles=recycles,\n",
        "            mean_plddt=mean_plddt,\n",
        "            min_plddt=min_plddt,\n",
        "            max_plddt=max_plddt,\n",
        "            mean_pae=mean_pae,\n",
        "            final_positions=cache[\"positions\"][recycles],\n",
        "            plddt_scores=final_plddt,\n",
        "            pae_matrix=final_pae,\n",
        "            execution_time=execution_time\n",
        "        )\n",
        "\n",
        "    def fold_sequences_batch(self, sequences: List[str], recycles: int = 0,\n",
        "                           save_pdbs: bool = False) -> List[FoldingResult]:\n",
        "        \"\"\"Fold multiple sequences and return results\"\"\"\n",
        "        results = []\n",
        "\n",
        "        self._print(f\"Folding {len(sequences)} sequences with {recycles} recycles...\")\n",
        "\n",
        "        for i, seq in enumerate(sequences):\n",
        "            if self.verbose:\n",
        "                print(f\"\\nProcessing sequence {i+1}/{len(sequences)}\")\n",
        "\n",
        "            pdb_file = f\"structure_{i+1}.pdb\" if save_pdbs else None\n",
        "\n",
        "            try:\n",
        "                result = self.fold_sequence(seq, recycles, pdb_file)\n",
        "                results.append(result)\n",
        "\n",
        "                if self.verbose:\n",
        "                    print(f\"Completed: Length={result.length}, \"\n",
        "                          f\"Mean pLDDT={result.mean_plddt:.2f}, \"\n",
        "                          f\"Mean PAE={result.mean_pae:.2f}, \"\n",
        "                          f\"Time={result.execution_time:.1f}s\")\n",
        "            except Exception as e:\n",
        "                self._print(f\"Error processing sequence {i+1}: {e}\")\n",
        "                # Continue with next sequence\n",
        "                continue\n",
        "\n",
        "        return results\n",
        "\n",
        "    def get_summary_dataframe(self, results: List[FoldingResult]) -> pd.DataFrame:\n",
        "        \"\"\"Convert results to a summary DataFrame\"\"\"\n",
        "        summary_data = []\n",
        "\n",
        "        for i, result in enumerate(results):\n",
        "            summary_data.append({\n",
        "                'Sequence_ID': i + 1,\n",
        "                'Length': result.length,\n",
        "                'Recycles': result.recycles,\n",
        "                'Mean_pLDDT': result.mean_plddt,\n",
        "                'Min_pLDDT': result.min_plddt,\n",
        "                'Max_pLDDT': result.max_plddt,\n",
        "                'Mean_PAE': result.mean_pae,\n",
        "                'Execution_Time_s': result.execution_time,\n",
        "                'Sequence': result.sequence[:50] + ('...' if len(result.sequence) > 50 else '')\n",
        "            })\n",
        "\n",
        "        return pd.DataFrame(summary_data)"
      ],
      "metadata": {
        "cellView": "form",
        "id": "l1HDAw8a_xEy"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "%%writefile seqs.txt\n",
        "MAEELAAKQKLEELEKQLEQLEQAVGGGGSAAKQKLEELEKQLEQLEQAVGGGGSAAKQKLEELEKQLEQLEQAVGGGGSAAKQKLEELEKQLEQLEQAV\n",
        "MALIKALEKELAALEKIAAAAGGGGSMALIKALEKELAALEKIAAAAGGGGSMALIKALEKELAALEKIAAAAGGGGSMALIKALEKELAALEKIAAAA\n",
        "MALIQKLEEKLLEIAKELLAAGGGTELIKKLEEKLLKIAKDLLEAGGGTEAIQKLEEKLLEIAKELLAAGGGTELIKKLEEKLLKIAKDLLEA\n",
        "MSNLEIKKLIEELVKIAALGGGSGQLEIRKELLEILKQLVAEGGGSDNLKQIKELLEALKRILEAGGGSEKLQKLEELVEAIEQLVAA\n",
        "MSNLEIKKLIEELVKIAALGPGDQLKIRKELLEILKQLVAEGPNDNLEQIKELLEALKRILEAGPGSEKLQKLEELVEAIEQLVAA\n",
        "MLAQIEAKLAQIEAKLAQIEAKLAQIEAKGSGSLAQIEAKLAQIEAKLAQIEAKLAQIEAKGSGSLAQIEAKLAQIEAKLAQIEAKLAQIEAKGSGSLAQIEAKLAQIEAKLAQIEAKLAQIEAK\n",
        "EIAALEAKNAALKAEIAALEAKNAALKGPGTGELAAEAEQLARLEELVEEALEQLARELGPGTGEIAALEAKNAALKAEIAALEAKNAALKGPGTGELAAEAEQLARLEELVEEALEQLAREL\n",
        "NEIAALEAKNAALKAEIAALEAKNAALKDSGSGNELKALEEAQLKAQELEAQLKAQELEAQDDSGSGNEIAALEAKNAALKAEIAALEAKNAALKDSGSGNELKALEEAQLKAQELEAQLKAQELEAQDD\n",
        "CEAIALKFEAIALKFEAIALKFEAIALKFEAIALKSGSGIQELKQEIQELKQEIQELKQEIQELKQEIQELKQESGSGCEAIALKFEAIALKFEAIALKFEAIALKFEAIALKSGSGIQELKQEIQELKQEIQELKQEIQELKQEIQELKQE\n",
        "NCEAIALKFEAIALKFEAIALKFEAIALKFEAIALKDDPPTCNIQELKQEIQELKQEIQELKQEIQELKQEIQELKQEDDDPPTNCEAIALKFEAIALKFEAIALKFEAIALKFEAIALKDDPPTCNIQELKQEIQELKQEIQELKQEIQELKQEIQELKQEDD\n",
        "LKALEKELKALEKELKALEKELKALEKEGGPGSIKALEQKIKALEQKIKALEQKIKALEQKGGTGSLKALEKELKALEKELKALEKELKALEKEGGAGTIKALEQKIKALEQKIKALEQKIKALEQK\n",
        "LKALEKLKALEKLKALEKLKALEKLGGPGSIQALERIQALERIQALERIQALERIQGGPGSLKALEELKALEELKALEELKALEELGGPGSVQALDKVQALDKVQALDKVQALDKVQ\n",
        "MQEERKKLLEKLEKILDEVTDGAPDEARERIEKLAKDVKDELEEGDAKNMIEKFRDEMEQMYKDAPNAVMEQLLEEIEKLLKKA\n",
        "MAEAAEKLKEALKEALKEAGGGSAEAAEKLKEALKEALKEAGGGSAEAAEKLKEALKEALKEAGGGSAEAAEKLKEALKEALKEA\n",
        "MEIAALEKEIAALEKEIAALEKEIAALEKGPGEIAALEKEIAALEKEIAALEKEIAALEKGPGEIAALEKEIAALEKEIAALEKEIAALEKGPGEIAALEKEIAALEKEIAALEKEIAALEK\n",
        "MEIAALEKEIAALEKEIAALEKEIAALEKGGSGGKIAALKEKIAALKEKIAALKEKIAALKEGGSGGEIAALEKEIAALEKEIAALEKEIAALEKGGSGGKIAALKEKIAALKEKIAALKEKIAALKE\n",
        "MLKALEQKLKALEQKLKALEQKGGGSGLKALEQKLKALEQKLKALEQKGGGSGLKALEQKLKALEQKLKALEQKGGGSGLKALEQKLKALEQKLKALEQK\n",
        "TLKQLEAKLKQLEAKLKQLEAKNGGSGTLKQLEAKLKQLEAKLKQLEAKNGGSGTLKQLEAKLKQLEAKLKQLEAKNGGSGTLKQLEAKLKQLEAKLKQLEAKN\n",
        "MLKAIEAKLKAIEAKLKAIEAKGGGSGLKAIEAKLKAIEAKLKAIEAKGGGSGLKAIEAKLKAIEAKLKAIEAKGGGSGLKAIEAKLKAIEAKLKAIEAK\n",
        "MAEELKKLAEELKRLAEELKKLAGGGSGAEELKKLAEELKRLAEELKKLAGGGSGAEELKKLAEELKRLAEELKKLAGGGSGAEELKKLAEELKRLAEELKKLA\n",
        "MIEALAKKIEALAKKIEALAKKIEALAKKGGSGLEALAKKLEALAKKLEALAKKLEALAKKGGSGIEALSKKIEALSKKIEALSKKIEALSKKGGSGLEALSKKLEALSKKLEALSKKLEALSKK\n",
        "LAEIAKELAEIAKELAEIAKELAEIAKEGSGGGLKEIAELLKEIAELLKEIAELLKEIAELGSGGGLAKVAELLAKVAELLAKVAELLAKVAELGSGGGLAEVAKLLAEVAKLLAEVAKLLAEVAKL\n",
        "LKALEEKLKALEEKLKALEEKGPGSIEAIEELIEAIEELIEAIEELGPGSLQKALENLQKALENLQKALENGPGSIEAIEELIEAIEELIEAIEEL\n",
        "LEAIKSELEAIKSELEAIKSEGGGSGGVEALRAEVEALRAEVEALRAEGGGSGGLDAIRNELDAIRNELDAIRNEGGGSGGLEAIKSELEAIKSELEAIKSE\n",
        "EIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEK\n",
        "EIAALEKEIAALEKEIAALEKGGEIQALEQEIQALEQEIQALEKGGEISALEREISALEREISALERGGEIQALEKEIQALEKEIQALEK\n",
        "MKALEEKIAKLAEKLAAEIKKAGGGEIAKLAEKIAKLAAEKIGGGEKLAEKIAKLAEKLAAEIKK\n",
        "MKALEEKIAKLAAEKLAKGGGEIAKKLAEKIAEALGGGKIAEKLAKELAEKLAAGGGEKIAKELAKALAEKLAA\n",
        "MKALEEKIAKLAAEKLAKGGPEIAKKLAEKIAEALGGPKIAEKLAKELAEKLAAGGPEKIAKELAKALAEKLAA\n",
        "MKALEEAIKKLAAEKLAKGGPQIAEKLAEKIAEALGGPKLAEKIAKELAAKLAGGPEKLAKEIAKALAEKLAA\n",
        "MLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEK\n",
        "MDLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIKEKGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIKEKGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIKEKGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIKEK\n",
        "MDNSLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIEEGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIEEGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIEEGNGSGLEKIKEKLEKIKENPLEKIKEKLEKIKEKLEKIKEKLEKIEE\n",
        "MDNSLEKIKEKLEKIKEKLEKIKEKLEKIKEKEGNGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKEGNGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKEGNGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKE\n",
        "MLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKGGGSGLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEKLEKIKEK\n",
        "MEAAAKELQALEKQALQAELQAELQGGSGEAAAKELQALEKQALQAELQAELQGGSGEAAAKELQALEKQALQAELQAELQGGSGEAAAKELQALEKQALQAELQAELQ\n",
        "GEIAALEAKNAALKAEIAALEAKIAALKAEIGGGSGGEIAALEAKNAALKAEIAALEAKIAALKAEIGGGSGGEIAALEAKNAALKAEIAALEAKIAALKAEIGGGSGGEIAALEAKNAALKAEIAALEAKIAALKAEI\n",
        "MEIAALEKEIAALEKEIAALEKEIAALEKGGSGGEIAALEKEIAALEKEIAALEKEIAALEKGGSGGEIAALEKEIAALEKEIAALEKEIAALEKGGSGGEIAALEKEIAALEKEIAALEKEIAALEK\n",
        "MGLKAIAEKLKAIAEKLKAIAEKLKAIAEKGSGSLKAIAEKLKAIAEKLKAIAEKLKAIAEKGSGSLKAIAEKLKAIAEKLKAIAEKLKAIAEKGSGSLKAIAEKLKAIAEKLKAIAEKLKAIAEK\n",
        "EIAALEKEIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEKEIAALEKGGSGEIAALEKEIAALEKEIAALEKEIAALEK"
      ],
      "metadata": {
        "id": "5L6kOjuLkRAR",
        "outputId": "14b8a228-9d5f-4dce-843f-8e029a034ee3",
        "colab": {
          "base_uri": "https://localhost:8080/"
        }
      },
      "execution_count": 3,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Writing seqs.txt\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# Initialize the runner\n",
        "runner = ColabFoldRunner(verbose=False)\n",
        "runner.setup_environment()"
      ],
      "metadata": {
        "id": "EvUuSoNBn3xn"
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "for seq in open(\"seqs.txt\"):\n",
        "  seq = seq.rstrip()\n",
        "  result = runner.fold_sequence(seq, recycles=0)\n",
        "  print(result.mean_plddt)\n",
        "  plt.figure()\n",
        "  cf.plot_pseudo_3D(result.final_positions[:,1,:], c=result.plddt_scores, cmin=0.5, cmax=0.9)\n",
        "  plt.show()"
      ],
      "metadata": {
        "id": "V8HcUCokn5GP",
        "outputId": "69be83f7-aaa9-42dd-98d9-dcbd1eb1d854",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6145738959312439\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 43940 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6274347305297852\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 54720 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6362240314483643\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53172 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6369565725326538\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 49888 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.595639169216156\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 48384 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.9237234592437744\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 24940 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5679236650466919\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53564 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5737317800521851\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 47400 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5064882636070251\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 58596 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6104497313499451\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 56948 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.688208818435669\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 51756 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5609564781188965\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 38516 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.7634605169296265\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 48440 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6986543536186218\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53220 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.7930391430854797\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 35952 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8762446641921997\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 36508 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.7923358082771301\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53016 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6751974821090698\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 37912 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6656326055526733\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 46264 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8913217782974243\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 44536 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8007537126541138\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 60096 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8452176451683044\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 58876 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.811215877532959\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53568 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8435125350952148\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 52492 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8666664958000183\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 30956 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.7753336429595947\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 32864 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6613048315048218\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 46412 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6228164434432983\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 49024 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6581891775131226\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 44540 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.61386638879776\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 51572 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8164156079292297\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 49592 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5791894197463989\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 53724 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6930962204933167\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 45680 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5155742168426514\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 52496 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.82407146692276\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 54516 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.5980289578437805\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 46440 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.6388046741485596\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 57352 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.7822316884994507\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 52592 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8873701095581055\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 52004 characters]\n"
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "0.8693392872810364\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 640x480 with 0 Axes>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 500x500 with 1 Axes>"
            ],
            "image/png": "[encoded data, 25060 characters]\n"
          },
          "metadata": {}
        }
      ]
    }
  ]
}