Sails 0.2.0 Help

Sails::JSONLoader

class Sails::JSONLoader

The JSONLoader class is responsible for loading and parsing JSON files.

This class provides methods for loading a JSON data file and extracting data from it. It requires a path to the file and ResidueDatabase object to fill.

Summary

Members

Descriptions

publicJSONLoader() = default

publicJSONLoader(const std::string & path)

public voidinit(const std::string & path)

public ResidueDatabaseload_residue_database()

Loads the residue database from a JSON file.

public LinkageDatabaseload_linkage_database()

Loads the linkage database from a JSON file.

private std::stringm_path

private simdjson::ondemand::documentm_doc

private static std::vector<AtomSet>extract_atom_set(simdjson::simdjson_result< simdjson::ondemand::value > & value, const char * key)

Extracts a vector of AtomSet objects from a JSON value using the specified key.

private staticAngleSetextract_angles(simdjson::simdjson_result< simdjson::ondemand::value > & value)

Extracts angles from a JSON object.

private staticTorsionSetextract_torsions(simdjson::simdjson_result< simdjson::ondemand::value > & value)

Extracts the torsion angles from a JSON value.

Members

publicJSONLoader() = default

publicJSONLoader(const std::string & path)

public voidinit(const std::string & path)

public ResidueDatabaseload_residue_database()

Loads the residue database from a JSON file.

This method loads a JSON file containing residue data and parses it to create a ResidueDatabase object. It uses the simdjson library for efficient parsing. The path to the JSON file must be specified in the 'm_path' member variable.

Returns

The ResidueDatabase object containing the loaded residue data.

public LinkageDatabaseload_linkage_database()

Loads the linkage database from a JSON file.

This method loads a JSON file containing linkage data and parses it to create a LinkageDatabase object. It uses the simdjson library for efficient parsing. The path to the JSON file must be specified in the 'm_path' member variable.

Returns

The LinkageDatabase object containing the loaded residue data.

private std::stringm_path

private simdjson::ondemand::documentm_doc

private static std::vector<AtomSet>extract_atom_set(simdjson::simdjson_result< simdjson::ondemand::value > & value, const char * key)

Extracts a vector of AtomSet objects from a JSON value using the specified key.

This function takes a simdjson value and extracts an array of objects from it using the specified key. Each object in the array represents an AtomSet, which contains information about three atoms and an identifier. The extracted AtomSets are returned as a vector.

Parameters

  • value The simjson value to extract data from.

  • key The key to extract the array of AtomSet objects.

Returns

std::vectorSails::AtomSet The vector of extracted AtomSet objects.

private staticAngleSetextract_angles(simdjson::simdjson_result< simdjson::ondemand::value > & value)

Extracts angles from a JSON object.

This method extracts angles from a JSON object using keys "alpha", "beta", and "gamma".

Parameters

Returns

An AngleSet object containing the extracted angles.

private staticTorsionSetextract_torsions(simdjson::simdjson_result< simdjson::ondemand::value > & value)

Extracts the torsion angles from a JSON value.

This method extracts angles from a JSON object using the keys "phiMean", "phiStdDev", "psiMean", "psiStdDev", "omegaMean", and "omegaStdDev", each associated with a numerical value.

Parameters

Returns

A TorsionSet object containing the extracted torsion angles.

Last modified: 08 August 2024