Sails 0.2.0 Help

Sails::Glycan

struct Sails::Glycan

Glycan represents a glycan structure.

The Glycan class is responsible for constructing and managing a glycan structure composed of sugars. It provides methods for adding linkages between sugars, adding sugars to the glycan, printing the glycan structure, generating a DOT string representation of the glycan, writing the glycan to a DOT file, performing breadth-first search (BFS) traversal on the glycan structure, retrieving terminal sugars, and performing depth-first search (DFS) traversal on the glycan structure.

Summary

Members

Descriptions

publicGlycositeglycosite

Internal glycosite [[maybe_unused]]

public std::map<Sugar](Sails--Sugar.md#structSails_1_1Sugar) *, std::set< [Sugar* > >adjacency_list

Adjaceny list describing links between sugar pointers

public std::vector<Linkage>linkage_list

List of linkages used when creating link records

public std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >sugars

Sugars map used to store sugars in scope until the Glycan is destroyed

public gemmi::Structure *m_structure

Internal structure pointer - used so that the structure is updated with the caller's structure

public ResidueDatabasem_database

Internal residue database - used to write local dot files [[DEPRECATED]]

publicGlycan() = default

public inlineGlycan(constGlycan& other)

public inlineGlycan(gemmi::Structure * structure, ResidueDatabase & database,Glycosite& glycosite)

public inline std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >::const_iteratorbegin() const

Returns an iterator to the beginning of the map.

public inline std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >::const_iteratorend() const

Returns a iterator to the end of the map.

public inline boolempty() const

Checks if the container is empty.

public inline size_tsize() const

Returns the size of the sugar list.

public inline voidadd_linkage(Glycosite& sugar_1,Glycosite& sugar_2, const std::string & donor_atom, const std::string & acceptor_atom)

Adds linkage between two sugars.

public inline voidadd_sugar(const std::string & atom, int seqId,Glycosite& residue)

Adds a sugar molecule to be stored in this glycan.

public inlineSugar*remove_sugar(Sugar* sugar, bool erase_from_structure)

Remove a sugar molecule from the structure and update the adjacency list.

public inline std::optional<Sugar* >find_previous_sugar(Sugar* sugar) const

Finds the previous sugar molecule linked to the given sugar molecule.

public voidprint_list() const

Prints the adjacency list of the glycan structure.

public voidprint_sugars()

Prints the sugars contained within glycan structure.

public std::stringget_dot_string()

Retrieves a DOT representation of the glycan structure.

public voidwrite_dot_file(const std::string & path)

Writes a dot file at the specified path.

public voidbfs(Sugar* root)

Performs a breadth-first search (BFS) traversal on the glycan structure starting from the specified root sugar.

public std::vector<Sugar* >get_terminal_sugars(Glycosite& root_seq_id)

This function retrieves all the terminal sugars in a tree structure starting from the given root sugar.

public voiddfs(Sugar* current_sugar, std::vector<Sugar* > & terminal_sugars, int depth)

Performs a depth-first search (DFS) on a graph of sugar molecules, starting from a given sugar and collecting terminal sugars.

public inline gemmi::Structureget_structure() const

Get the structure associated with the glycan.

public std::set<Glycosite>operator-(constGlycan& glycan)

Subtract operator for Glycan objects.

Members

publicGlycositeglycosite

Internal glycosite [[maybe_unused]]

public std::map<Sugar](Sails--Sugar.md#structSails_1_1Sugar) *, std::set< [Sugar* > >adjacency_list

Adjaceny list describing links between sugar pointers

public std::vector<Linkage>linkage_list

List of linkages used when creating link records

public std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >sugars

Sugars map used to store sugars in scope until the Glycan is destroyed

public gemmi::Structure *m_structure

Internal structure pointer - used so that the structure is updated with the caller's structure

public ResidueDatabasem_database

Internal residue database - used to write local dot files [[DEPRECATED]]

publicGlycan() = default

public inlineGlycan(constGlycan& other)

public inlineGlycan(gemmi::Structure * structure, ResidueDatabase & database,Glycosite& glycosite)

public inline std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >::const_iteratorbegin() const

Returns an iterator to the beginning of the map.

Returns a constant iterator that points to the first element of the map. This iterator can be used to traverse the map in a forward direction.

Returns

A constant iterator that points to the first element of the map.

The map must not be modified while iterating over it using this iterator.

public inline std::map<Glycosite](Sails--Glycosite.md#structSails_1_1Glycosite), std::unique_ptr< [Sugar> >::const_iteratorend() const

Returns a iterator to the end of the map.

Returns a constant iterator that points to the last element of the map. This iterator can be used to compare with other iterators to check if it has reached the end of the map.

Returns

A constant iterator pointing to the end of the map.

The map must not be modified while iterating over it using this iterator.

public inline boolempty() const

Checks if the container is empty.

The empty method checks if the container is empty. It returns true if the container doesn't contain any elements, and false otherwise.

Returns

true if the container is empty, false otherwise.

public inline size_tsize() const

Returns the size of the sugar list.

The size of the sugar list represents the number of elements stored in it.

Returns

The size of the sugar list as a size_t value.

public inline voidadd_linkage(Glycosite& sugar_1,Glycosite& sugar_2, const std::string & donor_atom, const std::string & acceptor_atom)

Adds linkage between two sugars.

This function creates a linkage between two sugars by the seqId. Sugars must have been added with add_sugar before this function is called, if not, an error is raised.

Parameters

  • sugar_1_key The ID of the first sugar object.

  • sugar_2_key The ID of the second sugar object.

  • donor_atom

  • acceptor_atom

The specified sugar keys must be valid IDs of existing sugar objects.

Returns

void

public inline voidadd_sugar(const std::string & atom, int seqId,Glycosite& residue)

Adds a sugar molecule to be stored in this glycan.

The add_sugar method adds a sugar molecule to the collection of sugars. If the sugar molecule with the given seqId already exists in the collection, it will not be overwritten.

Parameters

  • atom The type of atom in the sugar molecule.

  • seqId The sequence ID of the sugar molecule.

  • residue The glycosite of the sugar molecule.

public inlineSugar*remove_sugar(Sugar* sugar, bool erase_from_structure)

Remove a sugar molecule from the structure and update the adjacency list.

The remove_sugar function removes a sugar molecule with the specified sequence ID from the structure and updates the adjacency list accordingly. It returns a pointer to the sugar molecule that was linked to the removed sugar molecule.

Parameters

  • sugar A pointer to the sugar molecule to be removed.

  • erase_from_structure Whether to erase the corresponding residue from the structure member.

Returns

A pointer to the sugar molecule that was linked to the removed sugar molecule, or nullptr if no sugar molecule was linked.

public inline std::optional<Sugar* >find_previous_sugar(Sugar* sugar) const

Finds the previous sugar molecule linked to the given sugar molecule.

The find_previous_sugar method searches for the previous sugar molecule linked to the given sugar molecule within the adjacency list. It iterates through the adjacency list and checks if the given sugar molecule is found as an acceptor in any of the pair values. If found, it returns the corresponding donor sugar molecule. If no previous sugar is found, it returns std::nullopt.

Parameters

  • sugar A pointer to the sugar molecule for which to find the previous sugar molecule.

Returns

An optional pointer to the previous sugar molecule linked to the given sugar, or std::nullopt if not found.

public voidprint_list() const

Prints the adjacency list of the glycan structure.

The print_list() function iterates over the adjacency list of the glycan structure and prints each sugar and its linked siblings. It retrieves the residue information from the gemmi::Structure and gemmi::Residue objects and prints them as part of the output. The output is printed to the console.

Returns

void

public voidprint_sugars()

Prints the sugars contained within glycan structure.

Returns

void

public std::stringget_dot_string()

Retrieves a DOT representation of the glycan structure.

The get_dot_string() function generates a DOT string representation of the glycan structure. The function uses the adjacency list to traverse the sugars and their linked siblings to construct the DOT string. The DOT string represents the relationships between sugars as edges and the sugars themselves as nodes.

Returns

A string containing the DOT representation of the glycan structure.

public voidwrite_dot_file(const std::string & path)

Writes a dot file at the specified path.

This function takes a path to a dot file as input and writes a dot file at the specified location. The dot file is used for creating graphs using Graphviz graph visualization software.

Parameters

  • path The path to the dot file to be written.

public voidbfs(Sugar* root)

Performs a breadth-first search (BFS) traversal on the glycan structure starting from the specified root sugar.

The bfs() function implements the breadth-first search algorithm to traverse the glycan structure in a level-wise manner. It starts from the root sugar and visits all its linked sugars before moving on to the next level of sugars. The function uses a queue to keep track of the sugars to be visited and a set to keep track of visited sugars. It also uses a map to store the level of each sugar in the traversal.

Parameters

  • root A pointer to the root sugar from which the traversal starts.

Returns

void

public std::vector<Sugar* >get_terminal_sugars(Glycosite& root_seq_id)

This function retrieves all the terminal sugars in a tree structure starting from the given root sugar.

The function takes a pointer to the root sugar of a tree structure as input and returns a collection of all the terminal sugars in that tree structure.

Parameters

  • root The seqId to the root residue of the tree structure.

Exceptions

  • std::runtime_error If supplied root_seq_id is invalid.

Returns

A collection of terminal sugars in the tree structure.

public voiddfs(Sugar* current_sugar, std::vector<Sugar* > & terminal_sugars, int depth)

Performs a depth-first search (DFS) on a graph of sugar molecules, starting from a given sugar and collecting terminal sugars.

Parameters

  • current_sugar - The current sugar molecule being visited.

  • terminal_sugars - A vector to store the terminal sugar molecules found.

  • depth - The depth of the current search

public inline gemmi::Structureget_structure() const

Get the structure associated with the glycan.

This method returns the gemmi::Structure object associated with the glycan.

Returns

The gemmi::Structure object associated with the glycan.

See also: gemmi::Structure

public std::set<Glycosite>operator-(constGlycan& glycan)

Subtract operator for Glycan objects.

The operator- subtracts the glycosites of two Glycan objects and returns the set of unique glycosites that exist in the first Glycan object but not in the second Glycan object.

Parameters

  • glycan The Glycan object to subtract from the current Glycan object.

Returns

The set of unique glycosites that exist in the first Glycan object but not in the second Glycan object.

The function is marked with [[nodiscard]] to indicate that the return value should not be ignored.

Last modified: 08 August 2024