simbad.lattice.latticesearch module

Module to skim the PDB for similar unit cells

class LatticeSearch(lattice_db_fname, model_dir)[source]

Bases: object

A class to do a search for PDB entries with similar unit cell dimensions

Attributes:
lattice_db_fname

The path to the lattice database

model_dir

The path to the model directory

Methods

calculate_niggli_cell(unit_cell, space_group) Calculate the parameters of the Niggli cell
calculate_penalty(query, reference) Calculate the linear cell variation between unit cells
calculate_probability(penalty_score) Calculate the probability that a penalty score will give a solution
calculate_volume_difference(query, reference) Calculate the difference in volume between the query unit cell and the reference unit cell
cell_within_tolerance(query, reference, …) Compare two cells and determine if query is within reference cell parameter tolerance
check_sg(sg) Check the space group for known anomalies
copy_results(source, destination) Copy the results from a local copy of the PDB
download_results(destination) Download the results directly from the PDB
pdb_in_results(pdb_code, results) Check to see if a pdb_code has already been appended to the results
search(space_group, unit_cell[, tolerance, …]) Search for similar Niggli cells
summarize(csvfile) Summarize the search results
static calculate_niggli_cell(unit_cell, space_group)[source]

Calculate the parameters of the Niggli cell

Parameters:
unit_cell : list, tuple

The parameters of the unit cell

space_group : str

The space group

Returns:
list

The Niggli cell parameters

classmethod calculate_penalty(query, reference)[source]

Calculate the linear cell variation between unit cells

Parameters:
query : list, tuple

The query cell parameters

reference : list, tuple

The reference cell parameters

Returns:
float

Total penalty

float

Length penalty

float

Angle penalty

classmethod calculate_probability(penalty_score)[source]

Calculate the probability that a penalty score will give a solution

Parameters:
penalty_score : float

The total penalty score calculate for a search result

Returns:
float

Probability score

classmethod calculate_volume_difference(query, reference)[source]

Calculate the difference in volume between the query unit cell and the reference unit cell

Parameters:
query : list, tuple

The query cell parameters

reference : list, tuple

The reference cell parameters

Returns:
float

The absolute difference in cell volumes

classmethod cell_within_tolerance(query, reference, tolerance)[source]

Compare two cells and determine if query is within reference cell parameter tolerance

Parameters:
query : list, tuple

The query cell parameters

reference : list, tuple

The reference cell parameters

tolerance : list, tuple

The tolerance cell parameter values

Returns:
bool
static check_sg(sg)[source]

Check the space group for known anomalies

copy_results(source, destination)[source]

Copy the results from a local copy of the PDB

Parameters:
source : str

The path to copy results from

destination : str

The path to save results to

Raises:
ValueError

No search results found/available

ValueError

Output directory does not exist

IOError

Search result not found in installed PDB

download_results(destination)[source]

Download the results directly from the PDB

Parameters:
destination : str

The path to save results to

Raises:
ValueError

No search results found/available

ValueError

Output directory does not exist

RuntimeError

Unable to download PDB

lattice_db_fname

The path to the lattice database

model_dir

The path to the model directory

static pdb_in_results(pdb_code, results)[source]

Check to see if a pdb_code has already been appended to the results

search(space_group, unit_cell, tolerance=0.05, max_to_keep=50, max_penalty=12)[source]

Search for similar Niggli cells

Parameters:
unit_cell : list, tuple

The parameters of the unit cell

space_group : str

The space group

tolerance : int, float, optional

The tolerance applied for Niggli cell comparison [default: 0.05]

max_to_keep : int, optional

The top-N number of results to return [default: 50]

max_penalty : int, optional

The total penalty score over which results are ignored [default: 12]

summarize(csvfile)[source]

Summarize the search results

Parameters:
csvfile : str

The path to an output CSV file