Поиск подходящего варианта под данный запрос: estrogen, поиск во всех текстовых полях, дата публикации с 2010-01-01 по 2015-01-01, разрешение не хуже 2.6, число лигандов не меньше 3
!pip install nglview # загрузка внешнего пакета nglview, который позволит визуализировать структуру биомакромолекул внутри jupyter notebook
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: nglview in /usr/local/lib/python3.7/dist-packages (2.7.7)
Requirement already satisfied: ipywidgets>=7 in /usr/local/lib/python3.7/dist-packages (from nglview) (7.5.1)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from nglview) (1.20.1)
Requirement already satisfied: ipykernel>=4.5.1 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7->nglview) (5.5.0)
Requirement already satisfied: ipython>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7->nglview) (7.21.0)
Requirement already satisfied: widgetsnbextension~=3.5.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7->nglview) (3.5.1)
Requirement already satisfied: traitlets>=4.3.1 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7->nglview) (5.0.5)
Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7->nglview) (5.1.2)
Requirement already satisfied: tornado>=4.2 in /usr/local/lib/python3.7/dist-packages (from ipykernel>=4.5.1->ipywidgets>=7->nglview) (6.1)
Requirement already satisfied: jupyter-client in /usr/local/lib/python3.7/dist-packages (from ipykernel>=4.5.1->ipywidgets>=7->nglview) (6.1.11)
Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (0.18.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (3.0.16)
Requirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (4.4.2)
Requirement already satisfied: backcall in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (0.2.0)
Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (4.8.0)
Requirement already satisfied: pickleshare in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (0.7.5)
Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (2.8.0)
Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0->ipywidgets>=7->nglview) (54.0.0)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.7/dist-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets>=7->nglview) (0.8.1)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets>=7->nglview) (3.2.0)
Requirement already satisfied: jupyter-core in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets>=7->nglview) (4.7.1)
Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets>=7->nglview) (0.2.0)
Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (20.3.0)
Requirement already satisfied: six>=1.11.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (1.15.0)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (3.7.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (0.17.3)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.7/dist-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets>=7->nglview) (0.7.0)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.7/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets>=7->nglview) (0.2.5)
Requirement already satisfied: notebook>=4.4.1 in /usr/local/lib/python3.7/dist-packages (from widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (6.2.0)
Requirement already satisfied: argon2-cffi in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (20.1.0)
Requirement already satisfied: nbconvert in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (6.0.7)
Requirement already satisfied: Send2Trash>=1.5.0 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.5.0)
Requirement already satisfied: terminado>=0.8.3 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.9.2)
Requirement already satisfied: prometheus-client in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.9.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (2.11.3)
Requirement already satisfied: pyzmq>=17 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (22.0.3)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets>=7->nglview) (2.8.1)
Requirement already satisfied: cffi>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.14.5)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (2.20)
Requirement already satisfied: typing-extensions>=3.6.4 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets>=7->nglview) (3.4.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.1.1)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.7.0)
Requirement already satisfied: entrypoints>=0.2.2 in /usr/lib/python3/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.3)
Requirement already satisfied: jupyterlab-pygments in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.1.2)
Requirement already satisfied: testpath in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.4.4)
Requirement already satisfied: bleach in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (3.3.0)
Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.4.3)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.5.3)
Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.8.4)
Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.7/dist-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.5.1)
Requirement already satisfied: async-generator in /usr/local/lib/python3.7/dist-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (1.10)
Requirement already satisfied: webencodings in /usr/local/lib/python3.7/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (0.5.1)
Requirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (20.9)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7->nglview) (2.4.7)
WARNING: You are using pip version 21.0.1; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
import nglview as nv
import requests # Этот стандартный модуль позволяет посылать запросы к веб-ресурсам
import json # Этот стандартный модуль позволяет легко работать с текстовым форматом json
my_query = {
"query": {
"type": "group",
"logical_operator": "and",
"nodes": []
},
"return_type": "entry"
}
example_field_search = {
"type": "terminal",
"service": "full_text", # Поиск ключевого слова во всех полях текста
"parameters": {
"value": "estrogen", #Ключевое слово
}
}
my_query["query"]["nodes"].append(example_field_search)
resolution_clause = {
"type": "terminal",
"service": "text",
"parameters": {
"value": 2.6 , # Разрешение не хуже 2,6
"attribute": "rcsb_entry_info.resolution_combined",
"operator": "less_or_equal"
}
}
my_query["query"]["nodes"].append(resolution_clause)
has_ligand_clause = {
"type": "terminal",
"service": "text",
"parameters": {
"attribute": "rcsb_entry_info.nonpolymer_entity_count",
"value": 3, # Число лигандов не меньше 3
"operator": "greater"
}
}
my_query["query"]["nodes"].append(has_ligand_clause)
#Дата публикации записи: с 1 января 2010 по 1 января 2015
date_range_clause = {
"type": "terminal",
"service": "text",
"parameters": {
"attribute": "rcsb_accession_info.initial_release_date",
"value": {
"from": "2010-01-01",
"to": "2015-01-01",
},
"operator": "range"
}
}
my_query["query"]["nodes"].append(date_range_clause)
rcsb = 'https://search.rcsb.org/rcsbsearch/v1/query'
json_query = json.dumps(my_query) # Функция dumps буквально значит "dump string",
# то есть превращает словарь в строку
# с правильным форматированием
search = requests.post(f'{rcsb}', data=json_query)
search_result = search.json() # Распаковываем ответ сервера в словарь
best_hit = search_result["result_set"][0] # лучший результат
best_hit
{'identifier': '4JVL', 'score': 0.9999571982372446, 'services': [{'service_type': 'full_text', 'nodes': [{'node_id': 15826, 'original_score': 7.962393283843994, 'norm_score': 0.9998287929489784}]}, {'service_type': 'text', 'nodes': [{'node_id': 1428, 'original_score': 1.0, 'norm_score': 1.0}, {'node_id': 15786, 'original_score': 1.0, 'norm_score': 1.0}, {'node_id': 23816, 'original_score': 1.0, 'norm_score': 1.0}]}]}
Таким образом, я далее буду работать с PDB ID 4JVL
По индификатору 4JVL была найдена кристаллическая структура эстрогенсульфотрансферазы человека (SULT1E1) в комплексе с неактивным кофактором PAP и эстрадиолом(E2). Данная запись связана со статьей, описывающей проблему ингибирования эстрогенсульфотрансферазы бромированными антипиренами (BFR), что может приводить к нарушению метаболизма эстрогена.
view = nv.show_pdbid('4JVL') #загрузка структуры молекулы
view
Код для интерактивной ячейки для вариантов 5,6,9
from ipywidgets import interact, fixed
representations = [
'ball+stick', # шаростержневая модель
'backbone', # прямые линии, соединяющие С-альфа атомы
'cartoon', # условное отображение вторичной структуры
'helixorient', # упрощенное отображение
'hyperball', # сглаженная шаростержневая модель
'licorice', # стержневая модель (без шаров)
'line', # очень тонкая стержневая модель
'point', # атомы в виде плоских точек
'ribbon', # отображение остова в виде ленты
'rocket', # отображение альфа-спиралей как цилиндров
'rope', # отображение остова в виде колбасы
'spacefill', # атомы в виде шаров соотв. Ван-дер-Ваальсова радиуса
'surface', # поверхность
'trace', # сглаженная линия, соединяющая С-альфа атомы
'tube' # более сдержанный rope
]
colors = [
'random',
'uniform',
'atomindex', # от синего к красному с ростом номера атома
'residueindex', # от синего к красному с ростом номера остатка
'chainindex', # каждой цепи свой цвет
'sstruc', # стандартные цвета для типа вторичной структуры
'element', # стандартные цвета для химических элементов
'resname', # свой цвет каждому из 20 остатков
'bfactor', # чем темнее, тем подвижнее
'hydrophobicity', # чем темнее, тем гидрофобнее
]
my_examples = {
'Example 5': {
'description': '''
Белок в виде tube, покраска по типу вторичной структуры.
Боковые радикалы в стержневой модели, покрашены по гидрофобности.
Лиганды показаны линиями, покрашены по элементам.
Вода и ионы показаны в виде Ван-дер-Вальсовых сфер.
''',
'representations': [
{
'type': 'tube',
'params': {
'sele': 'protein',
'color': 'sstruc'
}
},
{
'type': 'licorice',
'params': {
'sele': 'sidechainAttached',
'color': 'hydrophobicity'
}
},
{
'type': 'trace',
'params': {
'sele': 'ligand',
'color': 'element'
}
},
{
'type': 'spacefill',
'params': {
'sele': 'ion',
'color': 'uniform'
}
},
{
'type': 'spacefill',
'params': {
'sele': 'water',
'color': 'uniform',
}
},
],
},
'Example 6': {
'description': '''
Белок в виде cartoon темно-серого цвета.
Боковые радикалы в виде линий светло-серого цвета.
Боковые радикалы полярных аминокислот в виде hyperball, покрашены по элементам.
Лиганды в шаростержневой модели, покрашены по элементам, углероды покрашены в темно-синий.
''',
'representations': [
{
'type': 'cartoon',
'params': {
'sele': 'protein',
'color': 'DarkGray'
}
},
{
'type': 'line',
'params': {
'sele': 'sidechainAttached',
'color': 'LightGrey'
}
},
{
'type': 'ball+stick',
'params': {
'sele': 'ligand and not _C',
'color': 'element'
}
},
{
'type': 'trace',
'params': {
'sele': 'ligand and _C',
'color': 'DarkBlue'
}
},
{
'type': 'hyperball',
'params': {
'sele': 'sidechainAttached and polar',
'color': 'element'
}
},
],
},
'Example 9': {
'description': '''
Остов белка в шаростержневой модели, покрашен по элементам.
Боковые радикалы в стержневой модели, покрашены по элементам.
Углероды остатков с 30 по 70-й покрашены в светло-голубой.
Лиганды показаны в виде линий, покрашены в любой оттенок оранжевого.
''',
'representations': [
{
'type': 'ball+stick',
'params': {
'sele': 'backbone',
'color': 'element'
}
},
{
'type': 'licorice',
'params': {
'sele': 'sidechainAttached',
'color': 'element'
}
},
{
'type': 'ball+stick',
'params': {
'sele': 'protein and _C and :A 30-70',
'color': 'LightBlue'
}
},
{
'type': 'line',
'params': {
'sele': 'ligand',
'color': 'LightSalmon'
}
},
],
},
}
def show_examples(view, example_name):
view.clear()
example = my_examples[example_name]
print(example['description'])
view.set_representations(example['representations'])
view.center()
view = nv.show_pdbid("4JVL", default_representation=False)
interact(show_examples, view=fixed(view), example_name=list(my_examples.keys()))
view