{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "try seq_alignment pypi package.ipynb", "provenance": [], "collapsed_sections": [], "authorship_tag": "ABX9TyPowmeLcCUpdHQn3t4cyKQJ", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "<a href=\"https://colab.research.google.com/gist/shadiakiki1986/cb35201984f4bf3c0678652a6aeb580d/try-seq_alignment-pypi-package.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" ] }, { "cell_type": "markdown", "metadata": { "id": "w2_k_Yjp3EzD" }, "source": [ "Example usage of https://github.com/ryanlstevens/seq_alignment" ] }, { "cell_type": "code", "metadata": { "id": "dchgdzjM267p" }, "source": [ "!pip install --quiet seq_alignment" ], "execution_count": 1, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "xowItfL_3Hdu" }, "source": [ "# fro readme\n", "from seq_alignment import global_similarity\n", "\n", "# Test values\n", "str1=list(\"vina one\")\n", "str2=list(\"vin yard one\")\n", "\n", "# Initalize matching class function\n", "sim_init = global_similarity(str1,str2,backtrace=True) # False\n", "\n", "# Run matching \n", "sim_init.run()" ], "execution_count": 5, "outputs": [] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "9Zfie0DJ3LwB", "outputId": "2bbbf531-d3b3-485b-d515-8070c0316d58" }, "source": [ "# Get edit distance\n", "print(\"EDIT DISTANCE\")\n", "print(sim_init.match_distance)" ], "execution_count": 6, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "EDIT DISTANCE\n", "-4\n" ] } ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "jZ1jjt9E3SB2", "outputId": "21903b55-e66d-4783-d70a-d0967cdf61cf" }, "source": [ "print(\"\\n\".join([\"\".join(x) for x in sim_init.match_alignment_table]))" ], "execution_count": 7, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "vin a one\n", "vin yard one\n", "SSSIISIISSSS\n" ] } ] } ] }