MMDS Client API

class MMDSSession(config, requests_session=NOTHING, is_authenticated=False)
class MMDSSessionConfig(token='', user='', password='', protocol='https', domain='none.eyesopen.us', orion_credentials='', api_prefix='', test_url='api/v1/auth/')

Most of the time, you won’t construct an MMDSSession, but will use the following method to generate one from a stored profile.

get_session(profile)

You can setup a MMDSSession with the config by doing the following

session = get_session("testing")

Inside a cube in Orion:

from mmdsclient import MMDSSessionConfig

mmds_user = APISession.get_user_profile().username
token = APISession.config.token
config = MMDSSessionConfig(
         protocol="https",
         domain="mmds.eyesopen.com",
         user=mmds_user,
         orion_credentials=token
      )
session = MMDSSession(config=config)

MMDS Types API

Experiment

class Experiment(id: int = None, session=None, created: str = None, revision: str = None, code: str = '', author: str = None, keywords: str = None, resolution: float = None, strdate: str = None, solved_date: str = None, revision_date: str = None, method: str = None, DPI: float = None, RFree: float = None, RFree_found: bool = None, structure: mmdsclient.types.StructureFile = None, density: mmdsclient.types.DensityFile = None, ligands: dict = {'ligands': {}}, sites: list = [], biounit: list = [], public: bool = True, tags=None)

MMDS Experiment

classmethod add(session, code, structure, meta, density=None, biounits=None)

Add an new experiment to MMDS

Parameters
  • session (MMDSSession) –

  • code (str) – Unique structure code (normally 4-leter code for public PDBs)

  • structure (str) – Filename containing the experimental structure (.pdb or .cif)

  • meta (spruce.OEStructureMetadata) – JSON file containing structure meta data.

  • density (str, optional) – Optional filename containing X-ray density (MTZ file) or cryo-EM map (MAP.GZ file)

  • biounits (str or list) – Filename or list of filenames for all biounit DUs for this experiment.

Returns

Experiment

Raises
  • InvalidCredentials – If the session contains invalid credentials

  • ValidationError – If structure is not a valid structure file

  • ValidationError – If meta[‘Author’] > 400 characters

  • ValidationError – If meta[‘Keywords’] > 800 characters

  • ValidationError – If meta[‘RevisionDate’] is blank

  • BadResponse – Server unable to respond

Family

class Family(id: int = None, session=None, title: str = '', unique_name: str = '', parent: Family = None, alignable: bool = False, reference: mmdsclient.types.DesignUnitFile = None, method: str = None, children: list = None)

MMDS Family

classmethod add(session, title, *, parent=None, reference=None, method='SiteSequence', pre_aligned=False)

Add a new Family to MMDS

Parameters
  • session (MMDSSession) –

  • title (str) – Title for this family

  • parent (int or str) – ID or title of parent family in tree, if any.

  • reference (FILE) – If alignable, reference OEDesignUnit file

  • method (string) – Superposition method (default=”SiteSequence”)

  • pre_aligned (bool) – Assume reference is already aligned to parent

Returns

Family

Raises
  • ValidationError – If a Family with this title already exists

  • ValidationError – If align==True and no reference is included

  • InvalidCredentials – If the current profile/session has invalid data

  • NotFoundResponse – If parent is not a valid Family ID

  • BadResponse – If an error occurs trying to add the Family

update(alignable=False)

Update properties of this family

Parameters

alignable (bool) – Toggle whether this family will align with siblings in the tree.

Raises
  • BadResponse – If an error occurs trying to update the dataset

  • InvalidCredentials – If the current profile/session has invalid data

Context

class Context(id: int = None, session=None, created: str = None, updated: str = None, title: str = '', type: str = '', active: bool = True, ref_structure: mmdsclient.types.DesignUnitFile = None, method: str = 'SiteSequence', view: dict = None, family: int = None, public: bool = True, context_frames: list = [])

MMDS Context

classmethod add(session, title, family_id, ref_structure, *, type='project', active=True, view=None, method='SiteSequence', pre_aligned=False, **kwargs)
Parameters
  • session

  • title

  • family_id (int or str) – Id or unique name for Family

  • ref_structure

  • type

  • active

  • view

  • method

  • pre_aligned (bool) – ref_structure is already superposed on family reference

  • **kwargs

Returns:

update(view=None, active=None)

Update properties of this Context

Parameters
  • {dict} (view) – Update 3D view parameters

  • active (bool) – Toggle whether this Context is active

Raises
  • BadResponse – If an error occurs trying to update the dataset

  • InvalidCredentials – If the current profile/session has invalid data

Site

class Site(id: int = None, session=None, url=None, created: str = None, title: str = '', favorite: int = 1000, experiment: mmdsclient.types.Experiment = None, ligand: dict = None, ligand_name: str = '', ligand_title: str = '', iridium_score: str = '', iridium_data: str = '', design_unit: mmdsclient.types.DesignUnitFile = None, surface_file: dict = None, interaction_image: dict = None, density_image: dict = None, bfactor_image: dict = None, ligand_image: dict = None, components: mmdsclient.types.DesignUnitComponentMap = {}, tags=None)

MMDS Site

classmethod add(session, expt_id, du_file, *, density_image=None, interaction_image=None, bfactor_image=None, **kwargs)

Add a new Site to MMDS.

Parameters
  • session

  • expt_id (int) – ID of Experiment this site is derived from.

  • du_file (str) – Filename of OEDesignUnit file to add

  • density_image (str) – Filename of OEGrapheme SVG of electron or EM density

  • interaction_image (str) – Filename of OEGrapheme SVG of OEInteractions

  • bfactor_image (str) – Filename of OEGrapheme SVG depicting BFactors

  • **kwargs

Returns

Site

Raises
  • ValidationError – If expt_id is not a valid MMDS Experiment

  • ValidationError – If du_file is not a valid OEDesignUnit file

  • ValidationError – If unable to create binding site surface for DU

  • BadResponse – If unable to add this new Site

Frame

class Frame(id: int = None, session=None, url=None, link=None, proteinID: int = None, ligandID: int = None, smiles: str = None, ligand_title: str = None, context_title: str = None, surface_file: dict = None, interaction_image: str = None, density_image: str = None, bfactor_image: str = None, ligand_image: str = None, created: str = None, title: str = '', origin: mmdsclient.types.Site = None, transform: str = None, fit_chain_order: list = None, density_grid: mmdsclient.types.DensityFile = None, diff_density_grid: mmdsclient.types.DensityFile = None, context: mmdsclient.types.Context = None, receptors: list = [], sequence: str = None, components: mmdsclient.types.DesignUnitComponentMap = {}, design_unit: mmdsclient.types.DesignUnitFile = None)

MMDS Frame - an aligned Site from a Context

classmethod add(session, context_id, site_id, *, site_du=None, map_file=None)

Add a new Frame to a Context based on an existing Site

Parameters
  • session (MMDSSession) –

  • context_id (int) – Id of destination Context

  • site_id (int) – Id of Site to use

Returns

Frame

Raises
  • ValidationError – If context_id or site_id are not valid IDs

  • BadResponse – If unable to add frame

classmethod update(session, frame_id, site_id)

Update a Frame in a Context based on an existing Site

Parameters
  • session (MMDSSession) –

  • frame_id (int) – Id of Frame to update

  • site_id (int) – Id of Site to use

Returns

Frame

Raises
  • ValidationError – If frame_id or site_id are not valid IDs

  • BadResponse – If unable to update frame

classmethod update_sequence(session, frame_id, sequence)

Update the sequence in a Frame, from alignment performed outside MMDS

Parameters
  • session (MMDSSession) –

  • frame_id (int) – ID of frame to update

  • sequence (str) – New sequence

Returns

Frame

New sequence should be in ‘chain order’ as defined in the current Frame

class StructureFile(session=None, pk: int = 0, filename: str = '', url: str = None, json: str = None)

MMDS structure/molecule file, part of other types

download()

Download the structure as bytes.

Returns

Returns structure as bytes in its native format

Return type

bytes

Raises
  • AuthorizationRequired

  • ValidationError – If filename is not a valid structure file

  • BadResponse

download_to_file(filename=None)

Download the structure to a file.

Parameters

filename (str) – Output file

Raises
  • AuthorizationRequired

  • ValidationError – If filename is not a valid output file of the same

  • format as the structure

  • BadResponse – Server failure

class DesignUnitFile(session=None, pk: int = 0, filename: str = '', url: str = None, json: str = None)

MMDS OEDesignUnit file, part of other types

download(session=None)

Download the OEDesignUnit as bytes.

Returns

OEDesignUnit in bytes (OEB format)

Return type

bytes

Raises
  • AuthorizationRequired

  • BadResponse

download_to_file(filename=None, session=None)

Download the structure to a file.

Parameters

filename (str) – Output file

Raises
  • AuthorizationRequired

  • ValidationError – If filename is not a valid output file of the same

  • type as the original OEDesignUnit

  • BadResponse – Server failure