moleculekit.opm module#

moleculekit.opm.align_to_opm(mol, molsel='all', maxalignments=3, opmid=None, macrotype='protein')#

Align a Molecule to proteins/nucleics in the OPM database by sequence search

This function requires BLAST+ to be installed. You can find the latest BLAST executables here: Once you have it installed, export it to your PATH before starting python so that it’s able to detect the blastp and makeblastdb executables. Alternatively install it via conda install blast -c bioconda

  • mol (Molecule) – The query molecule. The alignments will be done on the first frame only.

  • molsel (str) – The atom selection for the query molecule to use

  • maxalignments (int) – The maximum number of aligned structures to return

  • opmid (str) – If an OPM ID is passed the function will skip searching the database

  • macrotype (str) – If to align on “protein” or “nucleic”


results – Returns a number of alignements (maximum maxalignments). For each alignment it might contain a number of HSPs (high-scoring pairs) which correspond to different sequence alignments of the query on the same hit protein.

Return type:

list of dictionaries

moleculekit.opm.blast_search_opm(query, sequences)#
moleculekit.opm.generate_opm_sequences(opm_pdbs, outjson)#
moleculekit.opm.get_opm_pdb(pdbid, keep=False, keepaltloc='A', validateElements=False)#

Download a membrane system from the OPM.

  • pdb (str) – The 4-letter PDB code

  • keep (bool) – If False, removes the DUM atoms. If True, it keeps them.

  • keepaltloc (str) – Which altloc to keep if there are any

  • validateElements (bool) – Set to True to validate the elements read. Usually this will fail on OPM due to weird atom names


  • mol (Molecule) – The oriented molecule

  • thickness (float or None) – The bilayer thickness (both layers)


>>> mol, thickness = get_opm_pdb("1z98")
>>> mol.numAtoms
>>> thickness
>>> _, thickness = get_opm_pdb('4u15')
>>> thickness is None