{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example of using PySpark to find ligand interaction fingerprint\n", "\n", "Demo how to calculate ligand-polymer interaction data and maps it to polymer chains." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports and variables" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [], "source": [ "from pyspark import SparkConf, SparkContext \n", "from mmtfPyspark.io import mmtfReader\n", "from mmtfPyspark.interactions import InteractionFilter, InteractionFingerprinter\n", " \n", "# Create variables \n", "APP_NAME = \"MMTF_Spark\" \n", "\n", "# Configure Spark \n", "conf = SparkConf().setAppName(APP_NAME).setMaster(\"local[*]\") \n", "sc = SparkContext(conf=conf) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Download 1OHR structure" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "pdb = mmtfReader.download_mmtf_files(['1OHR'], sc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Find interactions of small molecules (except water)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | structureChainId | \n", "queryLigandId | \n", "queryLigandNumber | \n", "queryLigandChainId | \n", "targetChainId | \n", "groupNumbers | \n", "sequenceIndices | \n", "sequence | \n", "interactingChains | \n", "
---|---|---|---|---|---|---|---|---|---|
0 | \n", "1OHR.A | \n", "1UN | \n", "201 | \n", "A | \n", "A | \n", "[25, 27, 28, 29, 30, 49, 50, 80, 81, 82, 84] | \n", "[24, 26, 27, 28, 29, 48, 49, 79, 80, 81, 83] | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n", "2 | \n", "
1 | \n", "1OHR.B | \n", "1UN | \n", "201 | \n", "A | \n", "B | \n", "[8, 23, 25, 27, 28, 29, 30, 32, 47, 48, 49, 50... | \n", "[7, 22, 24, 26, 27, 28, 29, 31, 46, 47, 48, 49... | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n", "2 | \n", "