Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
deedf2e
Fixed metals detection from element
jlgelpi Jul 3, 2026
323dbd7
Remove test print
jlgelpi Jul 3, 2026
238a7b2
Fixed backbone links reported as covalent clashes for residues with i…
jlgelpi Jul 3, 2026
c99dc7d
Fixed reporting fields missing in AlphaFold Cif files
jlgelpi Jul 3, 2026
ded0814
Updated tests
jlgelpi Jul 3, 2026
01a9662
Added microheterogeneity warning
jlgelpi Jul 3, 2026
63e08c3
Fixed missing labels for modified residues
jlgelpi Jul 3, 2026
6d362f5
Fixed downloading message
jlgelpi Jul 3, 2026
319ff2b
Added residue names to backbone modified residues
jlgelpi Jul 3, 2026
8dc5e47
Fixed repeated hetatm stats with models present
jlgelpi Jul 3, 2026
d46f944
Fixed hetatm labels
jlgelpi Jul 3, 2026
7bc15c7
Clean obsolete code and unused comments
jlgelpi Jul 4, 2026
6e1cc15
Improved use of cached copy when -no_network in use
jlgelpi Jul 4, 2026
d884150
Added version tag to summary json output
jlgelpi Jul 22, 2026
7a00b30
Updated version to 3.16.3
jlgelpi Jul 22, 2026
ee4ee05
Fixed missing entry_id from headers
jlgelpi Jul 22, 2026
7a3af22
Added sequence mismatch analysis to sequences
jlgelpi Jul 22, 2026
ed0c1f7
Updated docs
jlgelpi Jul 22, 2026
a8b0114
Updated tests
jlgelpi Jul 22, 2026
baf240a
Updated Pending tasks
jlgelpi Aug 25, 2026
47bab76
Fixed Version
jlgelpi Aug 31, 2026
b226620
Fixed failing interactive options
jlgelpi Aug 31, 2026
53b991d
Minor style improvements
jlgelpi Aug 31, 2026
5017913
Fixed indentation
jlgelpi Aug 31, 2026
b8775cf
Style improvements
jlgelpi Aug 31, 2026
d48b045
Updated tests
jlgelpi Sep 1, 2026
0cb5aee
Style updates
jlgelpi Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
## v3.16.2 (2026.2)
## v3.16.3 (2026.3)
### Extended functions
- altloc
- Added warning for possible microheterogeneity (from alternative residue names)
- sequences
- Added analysis for possible sequence mismatches between canonincal and structure sequences.
Comment thread
jlgelpi marked this conversation as resolved.
- output
- Added version tag to summary json output
### Bug fixes
- metals
- Fixed confusion from CX or PB atom names
- Detected metals as part of other residues
- Load
- Fixed errors when required fields where missing from cif files
- Fixed use of cached copy when available when --no_network in use
- Fixed display of repeated ligand statistics from multiple models

## v3.16.2 (2026.6)
### New functions
- Added description of ligands/HETatms when available
- Added --no_network to prevent network usage when not available
### Extended functions
- water
- Added support for selective removal of water molecules according to contacts
- ligand, metals
- Added residue identification from PDB annotation (not available with --no_network)
### Bug fixes
- sequences
- Fixed missing initial fragment, structure sequence header
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The latest documentation of this package can be found in our readthedocs site:
[latest package documentation](http://biobb-structure-checking.readthedocs.io/en/latest/).

### Version
v3.16.2 June 2026
v3.16.3 Aug 2026

### Requirements

Expand Down
14 changes: 11 additions & 3 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
1.2.3 Select chains according to molecule type DONE
1.2.4 Renumber chains & Residues DONE
1.3. Detect/Select Alt Locations (altloc) DONE
1.3.1 Detect microheterogeity DONE (Added warning, should be fixed on Bio.PDB)
Comment thread
jlgelpi marked this conversation as resolved.
1.4. Detect Heavy Metals /Remove (metals) DONE
1.4.1 Check for coordination sphere
1.5. Detect Ligands /Remove (ligands) DONE
1.5.1 Process All Hetatms in a integrated way
1.5.2 Detect modified amino acids (identidy and guess original residue)
1.5.2 Detect modified amino acids (identify and guess original residue)
1.6. Detect DNA/RNA /Remove (na) DONE in chains
1.6.1 Include NA Topology WITHDRAWN Too much adaptation needed, use BNSTopology instead
1.7. Remove Water (remwat) DONE
Expand All @@ -22,6 +24,8 @@
1.9. Get Sequences DONE
1.9.1 Get sequence from PDB without canonical DONE
1.9.2 Output FASTA file DONE
1.9.3 Detect sequences mismatches canonical/structure to detect microheterogeneity or alignment errors DONE
1.9.4 Check Internal alignment for some corner cases 1a7c 136d

2. Fix Structure Errors/Modification
2.1. Detect/Fix Amides Assignment (amide) DONE
Expand All @@ -31,7 +35,7 @@
2.3. Detect insertion codes/Renum (inscode) DONE
2.3.1 Rebuild chains with proper numbering DONE
2.4. Complete side chains (fixside) DONE
2.4.1 Rebuild side chains (using modeller) DONE for protein
2.4.1 Rebuild side chains (using modeller) DONE for protein.
2.5. Mutate residues (mutate) DONE
2.5.1 Add/remove/revert modified residues
2.5.2 Mutate DNA residues DONE
Expand All @@ -45,6 +49,7 @@
2.6.4 Add hydrogens for NA chains DONE
2.6.5 Prepare input for AutoDock with flexible residues
2.6.6 Add Metals to residue library
2.6.7 Ligand protonation/tautomery
2.7. Complete backbone (backbone) DONE
2.7.1 Complete main chains DONE
2.7.2 Add ACE, NME caps DONE
Expand All @@ -53,6 +58,7 @@
2.7.5 Accept multiple templates
2.7.6 Fix modelled junctions
2.7.8 Rebuild backbone in the context of the complete molecule (also for --rebuild options)
2.7.9 Detect cyclic peptides (report and consider no OXT needed)
2.7.9 Detect and fix extra backbone atoms (like extra OXT)
2.8 FixALL module
- Model and Chain selected on demand
Expand All @@ -75,7 +81,9 @@
3.4. Possible Sequence Gaps (bckbone) DONE
3.4.1 Fix only-CA structures (Modeller)
3.5. Steric clashes (clashes) DONE
3.5.1. Severe Steric clashes DONE Revise new severe clashes
3.5.1. Severe Steric clashes.
3.5.1.2 Revise covalent bonds, possible cyclic backbones
3.5.1.3 Remove clashes from backbone with insertion codes DONE
3.5.2. CA Steric Clashes NO
3.5.3. Polar Donor Clashes DONE
3.5.4. Polar Acceptor Clashes DONE
Expand Down
2 changes: 1 addition & 1 deletion biobb_structure_checking/check_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main():

if args.command == 'commands':
help_str = header()
with open(opj(data_dir_path, cts.COMMANDS_HELP_PATH)) as help_file:
with open(opj(data_dir_path, cts.COMMANDS_HELP_PATH), 'r', encoding='utf-8') as help_file:
help_str += help_file.read()
pydoc.pager(help_str)
sys.exit(0)
Expand Down
12 changes: 8 additions & 4 deletions biobb_structure_checking/commands/add_hydrogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def fix(strcheck, opts, fix_data=None):
for r_at in fix_data['ion_res_list']:
res = r_at[0]
rcode = res.get_resname()
if ph_value <= std_ion[rcode]['pK']:

if float(ph_value) <= std_ion[rcode]['pK']:
ion_to_fix[res] = std_ion[rcode]['lowpH']
else:
ion_to_fix[res] = std_ion[rcode]['highpH']
Expand All @@ -132,6 +133,7 @@ def fix(strcheck, opts, fix_data=None):
for mut_res in mut.mutations:
ion_to_fix[mut_res['resobj']] = mut_res['new_id']
else:
strcheck.summary['add_hydrogen']['selection'] = []
if add_h_mode == 'int':
if not strcheck.args['quiet']:
print('Selection: interactive')
Expand All @@ -143,13 +145,15 @@ def fix(strcheck, opts, fix_data=None):
r_at for r_at in fix_data['ion_res_list']
if r_at[0].get_resname() == 'HIS'
]
strcheck.summary['add_hydrogen']['selection'] = []
else:
res_list = []

for r_at in res_list:
rcode = r_at[0].get_resname()
input_line = ParamInput(
"Select residue form for " + mu.residue_id(r_at[0]),
strcheck.args['non_interactive']
)
strcheck.args['non_interactive']
)
input_line.add_option_list('list', r_at[1].keys())
input_line.default = std_ion[rcode]['std']

Expand Down
67 changes: 36 additions & 31 deletions biobb_structure_checking/commands/altloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ def check(strcheck):
print(rid)
strcheck.summary['altloc'][rid] = {}
fix_data['altlocs'][res] = sorted(alt_loc_res[res][0].child_dict)
alts = set()
for atm in alt_loc_res[res]:
strcheck.summary['altloc'][rid][atm.id] = []
alt_str = f" {atm.id:4}"
for alt in sorted(atm.child_dict):
alts.add(alt)
alt_str += f" {alt} ({atm.child_dict[alt].occupancy:4.2f})"
strcheck.summary['altloc'][rid][atm.id].append({
'loc_label': alt,
'occupancy': atm.child_dict[alt].occupancy
})
print(alt_str)

if 'A' not in alts:
print(cts.MSGS['ALTLOC_NO_A'])
strcheck.summary['altloc'][rid]['no_altA'] = True
return fix_data


Expand All @@ -60,7 +64,7 @@ def fix(strcheck, opts, fix_data=None):
strcheck.args['non_interactive'],
set_none='All'
)
input_line.add_option_all()
input_line.add_option_none()
input_line.add_option_list('occup', ['occupancy'])
input_line.add_option_list('altids', altlocs, case='upper')
input_line.add_option_list(
Expand All @@ -78,34 +82,35 @@ def fix(strcheck, opts, fix_data=None):
if input_option == 'error':
return cts.MSGS['UNKNOWN_SELECTION'], select_altloc

if input_option != 'all':
print(f"Selecting location {select_altloc}")
if input_option in ('occup', 'altids'):
select_altloc = select_altloc.upper()
to_fix = {
res: {
'ats': value,
'select' : select_altloc
} for res, value in fix_data['alt_loc_res'].items()
}

elif input_option == 'resnum':
to_fix = {}
selected_rnums = {}
for rsel in select_altloc.split(','):
rnum, alt = rsel.split(':')
selected_rnums[rnum] = alt
to_fix = {
res: {
'ats': value,
'select': selected_rnums[mu.residue_num(res)]
}
for res, value in fix_data['alt_loc_res'].items()
if mu.residue_num(res) in selected_rnums
}
for res in to_fix:
strcheck.strucm.select_altloc_residue(res, to_fix[res])

strcheck.summary['altloc']['selected'] = select_altloc

if input_option == 'none':
print(cts.MSGS['ALTLOC_NO_SELECTION'])
return False

print(f"Selecting location {select_altloc}")
to_fix = {}
if input_option in ('occup', 'altids'):
select_altloc = select_altloc.upper()
to_fix = {
res: {
'ats': value,
'select' : select_altloc
} for res, value in fix_data['alt_loc_res'].items()
}
elif input_option == 'resnum':
to_fix = {}
selected_rnums = {}
for rsel in select_altloc.split(','):
rnum, alt = rsel.split(':')
selected_rnums[rnum] = alt
to_fix = {
res: {
'ats': value,
'select': selected_rnums[mu.residue_num(res)]
}
for res, value in fix_data['alt_loc_res'].items()
if mu.residue_num(res) in selected_rnums
}
for res in to_fix:
strcheck.strucm.select_altloc_residue(res, to_fix[res])
return False
7 changes: 6 additions & 1 deletion biobb_structure_checking/commands/backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ def check(strcheck):
print(cts.MSGS['MODIF_RESIDUES'])
strcheck.summary['backbone']['mod_residues'] = []
for brk in strcheck.strucm.st_data.modified_residue_list:
print(f" {mu.residue_id(brk):10}")
if strcheck.strucm.st_data.no_network:
print(f" {mu.residue_id(brk):10}")
else:
print(
f" {mu.residue_id(brk):10} ({mu.fetch_residue_name_by_id(brk.get_resname())})"
)
strcheck.summary['backbone']['mod_residues'].append(mu.residue_id(brk))
# Provisional only missing atoms can be fixed
fix_data['modified_residue_list'] = True
Expand Down
8 changes: 3 additions & 5 deletions biobb_structure_checking/commands/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,19 @@ def check(strcheck):


def fix(strcheck, opts, fix_data=None):
rename_chains = ''
rebuild_chains = False
renumber_chains = False
if isinstance(opts, str):
select_chains = opts
rename_chains = ''
else:
select_chains = opts['select']
if 'rename' in opts:
rename_chains = opts['rename']
else:
rename_chains = ''
if 'renumber' in opts:
renumber_chains = opts['renumber']
if 'rebuild' in opts:
rebuild_chains = opts['rebuild']
else:
rebuild_chains = False

if strcheck.strucm.chains_data.has_chains_to_rename:
input_line = ParamInput(
Expand Down
10 changes: 10 additions & 0 deletions biobb_structure_checking/commands/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def check(strcheck):
'canonical': can_seq,
'structure': pdb_seq
}
mismatches = strcheck.strucm.sequence_data.compare_sequences(strcheck.strucm)
if mismatches:
print(f"Found {len(mismatches)} mismatch(es)")
for chain_id, mismatch in mismatches.items():
print(
f"Chain {chain_id}\n"
f"{mismatch['canonical']}\n"
f"{mismatch['structure']}"
)
strcheck.summary['sequence_mismatches'] = mismatches
return fasta


Expand Down
13 changes: 7 additions & 6 deletions biobb_structure_checking/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
Global constants for structure_checking module
"""
import argparse
import os
from os.path import dirname
from os.path import join as opj


from biobb_structure_checking.pdbio.param_input import Dialog

VERSION = '3.16.2'
VERSION = '3.16.3'

# Default locations and settings
DATA_DIR_DEFAULT_PATH = 'dat'
Expand All @@ -23,7 +22,6 @@
TIME_LIMIT = 3600

ALT_SERVERS = {
'mmb': 'https://mmb.irbbarcelona.org/api/pdb',
'bsc': 'http://mdb-login.bsc.es/api/pdb'
}

Expand Down Expand Up @@ -412,7 +410,8 @@ def set_defaults(base_dir_path, args=None):

DIALOGS.add_entry('water', 'Checks and optionally removes water molecules')
DIALOGS.add_option('water', '--remove', 'remove', 'Remove All Water molecules')
DIALOGS.add_option('water', '--keep_min_contacts', 'keep', 'Remove All Water molecules with less contacts')
DIALOGS.add_option('water', '--keep_min_contacts', 'keep',
'Remove All Water molecules with less contacts')

DIALOGS.add_entry(
'ligands',
Expand Down Expand Up @@ -652,7 +651,7 @@ def set_defaults(base_dir_path, args=None):
'use --limit to adjust',
'TIME_LIMIT': 'Execution time limit ({}s) exceeded, aborting, use --time_limit to adjust',
'CA_ONLY_STRUCTURE': 'CA-Only structure, skipping',
'NO_NETWORK': 'Network disabled, unable to download {}',
'NO_NETWORK': 'Network disabled, unable to download {}, and no cached file available',
# command line
'ERROR_OPEN_FILE': 'Error when opening file',
'COMMAND_LIST_COMPLETED': 'Command list completed',
Expand Down Expand Up @@ -684,6 +683,8 @@ def set_defaults(base_dir_path, args=None):
# altloc
'ALTLOC_FOUND': 'Detected {} residues with alternative location labels',
'NO_ALTLOC_FOUND': 'Detected no residues with alternative location labels',
'ALTLOC_NO_A': 'Possible microheterogeneity: No A altloc found',
'ALTLOC_NO_SELECTION': 'No selection made, keeping all alternative locations',
# metals
'METALS_FOUND': 'Found {} Metal ions',
'NO_METALS_FOUND': 'No metal ions found',
Expand Down Expand Up @@ -784,7 +785,7 @@ def help(command=None):
DATA_DIR_DEFAULT_PATH,
COMMANDS_HELP_PATH
)
with open(help_path) as help_file:
with open(help_path, 'r', encoding='utf-8') as help_file:
print(help_file.read())
else:
DIALOGS.get_parameter(command, '', print_help=True)
17 changes: 17 additions & 0 deletions biobb_structure_checking/docs/source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## v3.16.3 (2026.3)
### Extended functions
- altloc
- Added warning for possible microheterogeneity (from alternative residue names)
- sequences
- Added analysis for possible sequence mismatches between canonincal and structure sequences.
Comment thread
jlgelpi marked this conversation as resolved.
- output
- Added version tag to summary json output
### Bug fixes
- metals
- Fixed confusion from CX or PB atom names
- Detected metals as part of other residues
- Load
- Fixed errors when required fields where missing from cif files
- Fixed use of cached copy when available when --no_network in use
- Fixed display of repeated ligand statistics from multiple models

## v3.16.2 (2026.2)
Comment thread
jlgelpi marked this conversation as resolved.
### New functions
- Added description of ligands/HETatms when available
Expand Down
4 changes: 2 additions & 2 deletions biobb_structure_checking/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
# built documents.
#
# The short X.Y version.
version = "3.16.2"
version = "3.16.3"
# The full version, including alpha/beta/rc tags.
release = "3.16.2"
release = "3.16.3"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Loading