{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "# This function is given in the assignment\n", "from scs import scs\n", "\n", "# You have to implement this function, or something like it\n", "from scs_list import scs_list" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 1" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "strings = ['ABC', 'BCA', 'CAB']" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'ABCAB'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Returns just one shortest superstring\n", "scs(strings)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "['ABCAB', 'BCABC', 'CABCA']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Returns list of all superstrings that are tied for shorest\n", "scs_list(strings)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Example 2" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "strings = ['GAT', 'TAG', 'TCG', 'TGC', 'AAT', 'ATA']" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'TCGATGCAATAG'" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Returns just one shortest superstring\n", "scs(strings)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "['AATAGATCGTGC',\n", " 'AATAGATGCTCG',\n", " 'AATAGTCGATGC',\n", " 'AATCGATAGTGC',\n", " 'AATGCTCGATAG',\n", " 'TCGAATAGATGC',\n", " 'TCGATAGAATGC',\n", " 'TCGATGCAATAG',\n", " 'TGCAATAGATCG',\n", " 'TGCAATCGATAG']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Returns list of all superstrings that are tied for shorest\n", "scs_list(strings)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }