{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example of using PySpark to find polymer interaction fingerprint\n", "\n", "Demo how to calculate polymer interaction data and maps it to polymer chains." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Imports and variables" ] }, { "cell_type": "code", "execution_count": 1, "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 ASP-ARG salt bridges" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | structureChainId | \n", "queryChainId | \n", "targetChainId | \n", "groupNumbers | \n", "sequenceIndices | \n", "sequence | \n", "
---|---|---|---|---|---|---|
0 | \n", "1OHR.A | \n", "B | \n", "A | \n", "[8] | \n", "[7] | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n", "
1 | \n", "1OHR.B | \n", "A | \n", "B | \n", "[8] | \n", "[7] | \n", "PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKM... | \n", "