From 4bbfab5aa43acc3efb2b7a3cb78907bbe64a2ed9 Mon Sep 17 00:00:00 2001 From: Anton Oresten Date: Sun, 1 Sep 2024 23:12:16 +0200 Subject: [PATCH] Delete kd.ipynb --- kd.ipynb | 111 ------------------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 kd.ipynb diff --git a/kd.ipynb b/kd.ipynb deleted file mode 100644 index 9aa49b2..0000000 --- a/kd.ipynb +++ /dev/null @@ -1,111 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\u001b[32m\u001b[1m Activating\u001b[22m\u001b[39m project at `c:\\Users\\anton\\.julia\\dev\\AssigningSecondaryStructure`\n" - ] - } - ], - "source": [ - "using Pkg; Pkg.activate(\".\")" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING: using LinearAlgebra.I in module Main conflicts with an existing identifier.\n" - ] - } - ], - "source": [ - "using AssigningSecondaryStructure\n", - "import AssigningSecondaryStructure as ASS\n", - "\n", - "using Backboner, NearestNeighbors\n", - "using LinearAlgebra" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "10-element Vector{Bool}:\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0\n", - " 0" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "coords = reshape(Protein.readpdb(\"test/data/1ASS.pdb\")[1].backbone.coords, 3, 3, :)\n", - "L = size(coords, 3)\n", - "\n", - "Ca_pos = coords[:, 2, :]\n", - "\n", - "pad_pos = fill(NaN, 3)\n", - "C_pos = coords[:, 3, :]\n", - "O_pos = [ASS.get_oxygen_positions(coords) pad_pos]\n", - "N_pos = coords[:, 1, :]\n", - "H_pos = [pad_pos ASS.get_hydrogen_positions(coords)]\n", - "\n", - "kdtree = KDTree(Ca_pos, Euclidean())\n", - "\n", - "for i in axes(coords, 3)[[4]]\n", - " js, dists = knn(kdtree, view(Ca_pos, :, 1), 10, true)\n", - " Hbonds = map(js) do j\n", - " i <= j <= i+2 && return false\n", - " r_ON = norm(O_pos[:, i] - N_pos[:, j])\n", - " r_CH = norm(C_pos[:, i] - H_pos[:, j])\n", - " r_OH = norm(O_pos[:, i] - H_pos[:, j])\n", - " r_CN = norm(C_pos[:, i] - N_pos[:, j])\n", - " E = ASS.Q1Q2 * ASS.F * (1/r_ON + 1/r_CH - 1/r_OH - 1/r_CN)\n", - " return E < ASS.CUTOFF\n", - " end\n", - " display(Hbonds)\n", - "end" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Julia 1.10.0", - "language": "julia", - "name": "julia-1.10" - }, - "language_info": { - "file_extension": ".jl", - "mimetype": "application/julia", - "name": "julia", - "version": "1.10.0" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}