nanome.api.schemas.structure_schemas module

class AtomSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_atom(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class BondSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_bond(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class ChainSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_chain(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class ComplexSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_complex(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class MoleculeSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_molecule(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class ResidueSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_residue(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
class StructureSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

determine_structure_schema(data)[source]

Use unique fields to determine schema to use for provided data.

dump(obj, *args, **kwargs)[source]

Serialize an object to native Python data types according to this Schema’s fields.

Parameters:
  • obj – The object to serialize.
  • many – Whether to serialize obj as a collection. If None, the value for self.many is used.
Returns:

Serialized data

New in version 1.0.0.

Changed in version 3.0.0b7: This method returns the serialized data rather than a (data, errors) duple. A ValidationError is raised if obj is invalid.

Changed in version 3.0.0rc9: Validation no longer occurs upon serialization.

load(data, *args, **kwargs)[source]

Deserialize a data structure to an object defined by this Schema’s fields.

Parameters:
  • data – The data to deserialize.
  • many – Whether to deserialize data as a collection. If None, the value for self.many is used.
  • partial – Whether to ignore missing fields and not require any fields declared. Propagates down to Nested fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.
  • unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE. If None, the value for self.unknown is used.
Returns:

Deserialized data

New in version 1.0.0.

Changed in version 3.0.0b7: This method returns the deserialized data rather than a (data, errors) duple. A ValidationError is raised if invalid data are passed.

opts = <marshmallow.schema.SchemaOpts object>
structure_schema_map = {<class 'nanome.api.structure.atom.Atom'>: <AtomSchema(many=False)>, <class 'nanome.api.structure.bond.Bond'>: <BondSchema(many=False)>, <class 'nanome.api.structure.residue.Residue'>: <ResidueSchema(many=False)>, <class 'nanome.api.structure.chain.Chain'>: <ChainSchema(many=False)>, <class 'nanome.api.structure.molecule.Molecule'>: <MoleculeSchema(many=False)>, <class 'nanome.api.structure.complex.Complex'>: <ComplexSchema(many=False)>}
class WorkspaceSchema(*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)[source]

Bases: marshmallow.schema.Schema

make_workspace(data, **kwargs)[source]
opts = <marshmallow.schema.SchemaOpts object>
init_object(obj, data: dict)[source]