{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Author Search Demo\n", "\n", "![pdbj](https://pdbj.org/content/default.svg)\n", "\n", "Example query for human protein-serine/threonine kinases using SIFTS data retrieved with PDBj Mine 2 webservices.\n", "\n", "\n", "## References\n", "\n", "The \"Structure Integration with Function, Taxonomy and Sequence\" is the authoritative source of up-to-date residue-level annotation of structures in the PDB with data available in UniProt, IntEnz, CATH, SCOP, GO, InterPro,Pfam and PubMed.\n", "[SIFTS](https://www.ebi.ac.uk/pdbe/docs/sifts/overview.html) \n", "\n", "Data are provided through: \n", "[Mine 2 SQL](https://pdbj.org/help/mine2-sql)\n", "\n", "Queries can be designed with the interactive\n", "[PDBj Mine 2 query service](https://pdbj.org/mine/sql)\n", "\n", "\n", "\n", "## Imports" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from pyspark import SparkConf, SparkContext\n", "from mmtfPyspark.webfilters import PdbjMineSearch\n", "from mmtfPyspark.mappers import StructureToPolymerChains\n", "from mmtfPyspark.io import mmtfReader" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Configure Spark Context" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "conf = SparkConf().setMaster(\"local[*]\") \\\n", " .setAppName(\"KinaseDemo\")\n", "sc = SparkContext(conf = conf)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Query for human protein-serine/threonine kinases using SIFTS data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "sql = \"SELECT t.pdbid, t.chain FROM sifts.pdb_chain_taxonomy AS t \"\\\n", " + \"JOIN sifts.pdb_chain_enzyme AS e ON (t.pdbid = e.pdbid AND t.chain = e.chain) \"\\\n", " + \"WHERE t.scientific_name = 'Homo sapiens' AND e.ec_number = '2.7.11.1'\"" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Read PDB and filter by author" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of entries matching query: 2722\n" ] } ], "source": [ "path = \"../../resources/mmtf_reduced_sample/\"\n", "\n", "pdb = mmtfReader.read_sequence_file(path, sc) \\\n", " .flatMap(StructureToPolymerChains()) \\\n", " .filter(PdbjMineSearch(sql))\n", "\n", "print(f\"Number of entries matching query: {pdb.count()}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Terminate Spark Context" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "sc.stop()" ] } ], "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.0" } }, "nbformat": 4, "nbformat_minor": 2 }