Raw PDB data

class mdk::pdb::Data

PDB file in the “raw format”, i.e. as a list of PDB records. Certain utility functions, like parsing from/to pdb::Model and retrieving only atom positions, are provided.

Public Functions

Data() = default
explicit Data(pdb::Model const &model)

Convert a PDB model into a set of records. In particular, extracts atom positions into ATOM records, contacts into SSBOND and LINK records, cell shape into CRYST1.

Parameters

model – PDB model to convert.

pdb::Model asModel() const

Convert the data into a PDB model (ATOM records into atoms, SSBOND and LINK records into contacts, CRYST1 into cell shape).

Returns

PDB model generated from the data.

Public Members

std::vector<records::Record> records

List of PDB records in the PDB file.

Public Static Functions

static Data onlyAtoms(pdb::Model const &model)

Extract only ATOM records from a PDB model. Useful for outputting a single file with lots of conformations of the same amino acid chain, for example when we output PDB model with consecutive positions in the simulation.

Parameters

model – PDB model to convert.

Returns

PDB data object containing only ATOM records.

Friends

friend Data &operator<<(Data &data, records::Record const &record)

Add a record to the PDB data object.

Parameters
  • data – PDB data object.

  • record – PDB record to add.

Returns

data but with added record

friend Data &operator<<(Data &data, Data const &other)

Append a list of records from another PDB data object.

Parameters
  • data – PDB data object

  • other – Another PDB data object from where to get the records

Returns

data but with added records from other

class mdk::pdb::Parser

A parser of PDB files.

Public Functions

Parser()
Data read(std::istream &is)

Read PDB data from an input stream.

Parameters

is – Input stream wherefrom to read the data.

Returns

Read PDB data.

std::ostream &write(std::ostream &os, Data const &data)

Write formatted PDB data to an output stream.

Parameters
  • os – Output stream whereto to write the PDB data.

  • data – PDB data to write.

Returns

os.

Private Members

std::unordered_map<int, std::shared_ptr<RecordParser>> parsers

(Internal) set of record parsers.