{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Extracting parts of a contact map\n\n\nThis example shows how to extract contact counts associated to some chromosomes\nof the contact maps. Here, we extract chromosomes 1, 4 and 5 of the budding\nyeasts contact map\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nfrom matplotlib import colors\n\nfrom iced import datasets\nfrom iced.utils import extract_sub_contact_map\n\n\n# Loading a sample dataset\ncounts, lengths = datasets.load_sample_yeast()\nsub_counts, sub_lengths = extract_sub_contact_map(counts, lengths, [0, 3, 4])\n\nfig, ax = plt.subplots()\nm = ax.matshow(sub_counts, cmap=\"Blues\", norm=colors.SymLogNorm(1),\n origin=\"bottom\",\n extent=(0, len(sub_counts), 0, len(sub_counts)))\n[ax.axhline(i, linewidth=1, color=\"#000000\") for i in sub_lengths.cumsum()]\n[ax.axvline(i, linewidth=1, color=\"#000000\") for i in sub_lengths.cumsum()]\ncb = fig.colorbar(m)\nax.set_title(\"Chromosomes I, IV and V of yeast\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 0 }