Skip to content

Commit

Permalink
Add parsing of PDB and PDBDEV ids from the database2 table
Browse files Browse the repository at this point in the history
  • Loading branch information
aozalevsky committed May 10, 2024
1 parent 71ceb76 commit 0e176aa
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 10 deletions.
20 changes: 20 additions & 0 deletions ihm_validation/mmcif_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,26 @@ def get_id_from_entry(self) -> str:
entry = entry_init.strip()
return entry

def get_pdb_id(self) -> str:
"""Check database2 table for PDB ID"""
entry_id = None
if len(self.system.databases) > 0:
for db in self.system.databases:
if db.id == 'PDB':
entry_id = db.code

return entry_id

def get_pdb_dev_id(self) -> str:
"""Check database2 table for PDB ID"""
entry_id = None
if len(self.system.databases) > 0:
for db in self.system.databases:
if db.id == 'PDB-Dev':
entry_id = db.code

return entry_id

def get_primary_citation_info(self) -> tuple:
'''get title and authors for the primary citation'''
title, authors = None, None
Expand Down
5 changes: 3 additions & 2 deletions ihm_validation/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy as np
from selenium import webdriver

REPORT_VERSION = '1.1'
REPORT_VERSION = '1.2-dev'

class WriteReport(object):
def __init__(self, mmcif_file, db, cache, nocache=False):
Expand Down Expand Up @@ -87,6 +87,8 @@ def run_entry_composition(self, Template_Dict: dict) -> dict:
entry_id[6:])]
Template_Dict['ID_R'] = (
entry_id[0:6]+'_'+entry_id[6:]).split()
Template_Dict['PDB_ID'] = self.input.get_pdb_id()
Template_Dict['PDBDEV_ID'] = self.input.get_pdb_dev_id()
Template_Dict['Molecule'] = self.input.get_struc_title()
Template_Dict['Authors'] = self.input.get_authors()
title, authors = self.input.get_primary_citation_info()
Expand Down Expand Up @@ -493,7 +495,6 @@ def run_supplementary_table(self,
Template_Dict['clustering'] = None
Template_Dict['location'] = location
Template_Dict['complex_name'] = self.input.get_struc_title()
Template_Dict['PDB_ID'] = self.input.get_id()
Template_Dict['Subunits'] = utility.get_subunits(
self.input.get_composition())
Template_Dict['datasets'] = utility.get_datasets(self.input.get_dataset_details(
Expand Down
20 changes: 16 additions & 4 deletions templates/full_validation_pdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,24 @@ <h2 align="center">{{ date }}</h2>
<div class="card-header" style="background-color: #FFFFFF;">
<div class="bs-example" class="text-center">
<table class="table table-bordered" style="height: 16rem;">
<thead>
{% if PDB_ID is not none %}
<tr>
<th align="center" class="text-center" style="text-align:center; vertical-align: middle;">PDB ID</th>
<th align="center" class="text-center" style="text-align:center; vertical-align: middle;">{{ ID_T }}</th>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">PDB ID</td>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">{{ PDB_ID }}</td>
</tr>
</thead>
{% endif %}
{% if PDBDEV_ID is not none %}
<tr>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">PDBDEV ID</td>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">{{ PDBDEV_ID }}</td>
</tr>
{% endif %}
{% if ((PDB_ID is none) and (PDBDEV_ID is none)) %}
<tr>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">Entry ID</td>
<td align="center" class="text-center" style="text-align:center; vertical-align: middle;">{{ ID_T }}</td>
</tr>
{% endif %}
<tr>
<td class="align-middle" class="text-center" style="text-align:center; vertical-align: middle;">Structure Name</td>
<td class="align-middle" class="text-center" style="text-align:center; vertical-align: middle;">{{ Molecule }}</td>
Expand Down
20 changes: 16 additions & 4 deletions templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,24 @@ <h5 align="center" style="text-align: center";>Download Summary Table</h5>
<div class="card-header" style="background-color:#FFFFFF; border-color:#003366;">
<div class="bs-example" class="text-center">
<table class="table table-bordered" style="border-color:#003366; height: 25rem;">
<thead>
{% if PDB_ID is not none %}
<tr>
<th align="center" class="text-center">PDB ID</th>
<th align="center" class="text-center">{{ID_T}}</th>
<td align="center" class="text-center">PDB ID</td>
<td align="center" class="text-center">{{PDB_ID}}</td>
</tr>
</thead>
{% endif %}
{% if PDBDEV_ID is not none %}
<tr>
<td align="center" class="text-center">PDBDEV ID</td>
<td align="center" class="text-center">{{PDBDEV_ID}}</td>
</tr>
{% endif %}
{% if ((PDB_ID is none) and (PDBDEV_ID is none)) %}
<tr>
<td align="center" class="text-center">Entry ID</td>
<td align="center" class="text-center">{{ID_T}}</td>
</tr>
{% endif %}
<tr>
<td class="align-middle" class="text-center">Structure title</td>
<td class="align-middle" class="text-center">{{Molecule}} </td>
Expand Down
6 changes: 6 additions & 0 deletions templates/summary_validation_pdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@
</style>
</head>
<body>
{% if PDB_ID is not none %}
<h3 class="center">Summary of integrative structure determination of {{complex_name}} ({{PDB_ID}}) </h3>
{% elif PDBDEV_ID is not none %}
<h3 class="center">Summary of integrative structure determination of {{complex_name}} ({{PDBDEV_ID}}) </h3>
{% else %}
<h3 class="center">Summary of integrative structure determination of {{complex_name}} ({{ID_T}}) </h3>
{% endif %}
<div class="ex1">
<table ID=t01>
<tr bgcolor ='silver'>
Expand Down

0 comments on commit 0e176aa

Please sign in to comment.