Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
PALSE_xml_DB Class Reference

Constructions

 __init__ (self)
 Default constructor.

Internal Methods

 __len__ (self)
 Number of trees in the database.
 append (self, et)
 Add a etree to the database.
 add_XML_etree (self, my_tree, tree_name)
 Add the given Element tree into the database (at the last position).

Load Files

 load_from_directory (self, input_dir, regex="", subdirs=False)
 Parse the input directory, possibly filter the filenames, and build one ETree for each file retained.
 sort_databases (self, varname, type=str, options_suffix="__options.xml")
 Sorts input databases by looking for each of them its corresponding options.xml file, and sorting following the value of the described option.
 add_pdb_namespaces (self)
 Add all namespaces specific to xml files from PDB.
 add_namespace (self, prefix, uri)
 Add a namespace represented by a URI and its prefix.

Boost Archive Identifiers

 __collect_boost_ids_recursive__ (self, tree, id_dict)
 Collect the ids recursively in a tree, exploring all the subtrees.
 __duplicate_boost_id_reference_recursive__ (self, tree, id_dict)
 In a tree, replace the boost id references for which the id exists in the dictionary.
 duplicate_boost_archive_references (self)
 If any references in a boost archive, replace them by copy of initial objects.

Hierarchy of Dataset

 __get_path_recursive__ (self, tree, path, paths)
 get_path_recursive
 __get_intersection_of_paths__ (self, paths_1, paths_2)
 get_intersection_of_paths
 __make_path_strings_as_list_recursive__ (self, path, paths)
 make_path_strings_as_list_recursive
 __make_path_strings_as_xml_recursive__ (self, deepness, paths)
 make_path_strings_as_xml_recursive
 get_common_hierarchy (self)
 Return the different paths that are common to all XML files in the dataset as a dictionnary.
 get_common_hierarchy_as_xml (self)
 Return the different paths that are common to all XML files in the dataset as a list of paths.
 get_common_hierarchy_as_list (self)
 Return the different paths that are common to all XML files in the dataset as a XML file.

Queries

 convert_prefix_to_uri (self, xpath_query)
 Convert all registered prefixes in the query to their associated URI.
 get_attribute (self, xpath_query)
 Returns the following pair: first, a boolean that is True iff the XPath query points to the attribute of a tag; second, if first is True, it is the attribute.
 get_all_elements_from_root (self, xpath_query, root)
 Retrieves the list of all the elements matching the XPath query from the given root.
 get_all_elements_from_tree (self, xpath_query, my_tree)
 Retrieves the list of all the elements matching the XPath query in the given ETree.
 get_all_elements_from_database (self, xpath_query)
 Retrieves the list of all the elements matching the XPath query in each ETree, and returns them as a list of lists (one list per ETree).
 is_data_value_in_tree (self, xpath_query, my_tree, data_value, type=str)
 Is the given data_value pointed by the given Xpath query.
 get_all_data_values_from_root (self, xpath_query, root, type=str)
 Retrieves the list of all the data_values matching the XPath query from the given root.
 get_all_data_values_from_tree (self, xpath_query, my_tree, type=str)
 Retrieves the list of all the data_values matching the XPath query in the given ETree.
 get_all_data_values_from_database (self, xpath_query, type=str)
 Retrieves the list of all the data_values matching the XPath query in each ETree, and returns them as a list of lists (one list per ETree)
 get_all_data_values_from_elements (self, elements, xpath_query, type=str)
 Retrieves the list of all the data_values matching the XPath query in the given list of elements.
 get_leftmost_data_value_from_tree (self, xpath_query, my_tree, type=str)
 Retrieves the first (leftmost) data_value matching the XPath query in the given ETree.
 get_leftmost_data_values_from_database (self, xpath_query, type=str)
 Retrieves list of leftmost data_values matching the XPath query over all the ETrees of the database (one leftmost data_value per ETree).
 get_rightmost_data_value_from_tree (self, xpath_query, my_tree, type=str)
 Retrieves the last (rightmost) data_value matching the XPath query in the given ETree.
 get_rightmost_data_values_from_database (self, xpath_query, type=str)
 Retrieves list of rightmost data_values matching the XPath query over all the ETrees of the database (one lrightmost data_value per ETree).
 get_data_source_file (self, xpath_query, data_value, type=str)
 Retrieves the filename list of all XML documents having the given data_value pointed by the given XPath query.
 get_filenames (self)
 Returns the list of filenames.

Filtering Elements

 get_all_data_values_from_database_compare_to (self, xpath_query, type, data_value, comp)
 get_all_data_values_from_database_compare_to
 get_all_data_values_from_database_equal_to (self, xpath_query, type, data_value)
 get_all_data_values_from_database_equal_to
 get_all_data_values_from_database_lower_than (self, xpath_query, type, data_value)
 get_all_data_values_from_database_lower_than
 get_all_data_values_from_database_greater_than (self, xpath_query, type, data_value)
 get_all_data_values_from_database_greater_than
 filter_elements_by_data_values_compare_to (self, elements, xpath_query, data_value, comp)
 Filter the input elements and create a list of filtered elements.
 filter_elements_by_data_values_equal_to (self, elements, xpath_query, data_value)
 Same as previous but with the equal comparator.
 filter_elements_by_data_values_lower_than (self, elements, xpath_query, data_value)
 Same as previous but with the less comparator.
 filter_elements_by_data_values_leq_than (self, elements, xpath_query, data_value)
 Same as previous but with the less or equal comparator.
 filter_elements_by_data_values_greater_than (self, elements, xpath_query, data_value)
 Same as previous but with the more comparator.
 filter_elements_by_data_values_geq_than (self, elements, xpath_query, data_value)
 Same as previous but with the more or equal comparator.

Detailed Description

A class to represent XML files having the same hierarchical structure.

   This class parses a list of xml files, returns
      one Element Tree (ETree) for each of them, and
      stores these in a DB consistin of a list.
      Furthermore, the class allows selecting
      specific elements common to all trees thanks to
      so-called XPath queries.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self)

Default constructor.

Member Function Documentation

◆ __collect_boost_ids_recursive__()

__collect_boost_ids_recursive__ ( self,
tree,
id_dict )

Collect the ids recursively in a tree, exploring all the subtrees.

◆ __duplicate_boost_id_reference_recursive__()

__duplicate_boost_id_reference_recursive__ ( self,
tree,
id_dict )

In a tree, replace the boost id references for which the id exists in the dictionary.

◆ __get_intersection_of_paths__()

__get_intersection_of_paths__ ( self,
paths_1,
paths_2 )

get_intersection_of_paths

◆ __get_path_recursive__()

__get_path_recursive__ ( self,
tree,
path,
paths )

get_path_recursive

◆ __len__()

__len__ ( self)

Number of trees in the database.

◆ __make_path_strings_as_list_recursive__()

__make_path_strings_as_list_recursive__ ( self,
path,
paths )

make_path_strings_as_list_recursive

◆ __make_path_strings_as_xml_recursive__()

__make_path_strings_as_xml_recursive__ ( self,
deepness,
paths )

make_path_strings_as_xml_recursive

◆ add_namespace()

add_namespace ( self,
prefix,
uri )

Add a namespace represented by a URI and its prefix.

◆ add_pdb_namespaces()

add_pdb_namespaces ( self)

Add all namespaces specific to xml files from PDB.

◆ add_XML_etree()

add_XML_etree ( self,
my_tree,
tree_name )

Add the given Element tree into the database (at the last position).

◆ append()

append ( self,
et )

Add a etree to the database.

◆ convert_prefix_to_uri()

convert_prefix_to_uri ( self,
xpath_query )

Convert all registered prefixes in the query to their associated URI.

◆ duplicate_boost_archive_references()

duplicate_boost_archive_references ( self)

If any references in a boost archive, replace them by copy of initial objects.

◆ filter_elements_by_data_values_compare_to()

filter_elements_by_data_values_compare_to ( self,
elements,
xpath_query,
data_value,
comp )

Filter the input elements and create a list of filtered elements.

For each element in the input list, if there exists a child pointed by the xpath query having as text a number positively compared to the input data_value with the imput comparator, it is added to the filtered output. Note that the pointed data_values have to be convertible to float.

◆ filter_elements_by_data_values_equal_to()

filter_elements_by_data_values_equal_to ( self,
elements,
xpath_query,
data_value )

Same as previous but with the equal comparator.

◆ filter_elements_by_data_values_geq_than()

filter_elements_by_data_values_geq_than ( self,
elements,
xpath_query,
data_value )

Same as previous but with the more or equal comparator.

◆ filter_elements_by_data_values_greater_than()

filter_elements_by_data_values_greater_than ( self,
elements,
xpath_query,
data_value )

Same as previous but with the more comparator.

◆ filter_elements_by_data_values_leq_than()

filter_elements_by_data_values_leq_than ( self,
elements,
xpath_query,
data_value )

Same as previous but with the less or equal comparator.

◆ filter_elements_by_data_values_lower_than()

filter_elements_by_data_values_lower_than ( self,
elements,
xpath_query,
data_value )

Same as previous but with the less comparator.

◆ get_all_data_values_from_database()

get_all_data_values_from_database ( self,
xpath_query,
type = str )

Retrieves the list of all the data_values matching the XPath query in each ETree, and returns them as a list of lists (one list per ETree)

◆ get_all_data_values_from_database_compare_to()

get_all_data_values_from_database_compare_to ( self,
xpath_query,
type,
data_value,
comp )

get_all_data_values_from_database_compare_to

◆ get_all_data_values_from_database_equal_to()

get_all_data_values_from_database_equal_to ( self,
xpath_query,
type,
data_value )

get_all_data_values_from_database_equal_to

◆ get_all_data_values_from_database_greater_than()

get_all_data_values_from_database_greater_than ( self,
xpath_query,
type,
data_value )

get_all_data_values_from_database_greater_than

◆ get_all_data_values_from_database_lower_than()

get_all_data_values_from_database_lower_than ( self,
xpath_query,
type,
data_value )

get_all_data_values_from_database_lower_than

◆ get_all_data_values_from_elements()

get_all_data_values_from_elements ( self,
elements,
xpath_query,
type = str )

Retrieves the list of all the data_values matching the XPath query in the given list of elements.

◆ get_all_data_values_from_root()

get_all_data_values_from_root ( self,
xpath_query,
root,
type = str )

Retrieves the list of all the data_values matching the XPath query from the given root.

◆ get_all_data_values_from_tree()

get_all_data_values_from_tree ( self,
xpath_query,
my_tree,
type = str )

Retrieves the list of all the data_values matching the XPath query in the given ETree.

◆ get_all_elements_from_database()

get_all_elements_from_database ( self,
xpath_query )

Retrieves the list of all the elements matching the XPath query in each ETree, and returns them as a list of lists (one list per ETree).

◆ get_all_elements_from_root()

get_all_elements_from_root ( self,
xpath_query,
root )

Retrieves the list of all the elements matching the XPath query from the given root.

◆ get_all_elements_from_tree()

get_all_elements_from_tree ( self,
xpath_query,
my_tree )

Retrieves the list of all the elements matching the XPath query in the given ETree.

◆ get_attribute()

get_attribute ( self,
xpath_query )

Returns the following pair: first, a boolean that is True iff the XPath query points to the attribute of a tag; second, if first is True, it is the attribute.

◆ get_common_hierarchy()

get_common_hierarchy ( self)

Return the different paths that are common to all XML files in the dataset as a dictionnary.

Note that only paths that are identical from the root of each XML file are stored.

◆ get_common_hierarchy_as_list()

get_common_hierarchy_as_list ( self)

Return the different paths that are common to all XML files in the dataset as a XML file.

Note that only paths that are identical from the root of each XML file are stored.

◆ get_common_hierarchy_as_xml()

get_common_hierarchy_as_xml ( self)

Return the different paths that are common to all XML files in the dataset as a list of paths.

Note that only paths that are identical from the root of each XML file are stored.

◆ get_data_source_file()

get_data_source_file ( self,
xpath_query,
data_value,
type = str )

Retrieves the filename list of all XML documents having the given data_value pointed by the given XPath query.

◆ get_filenames()

get_filenames ( self)

Returns the list of filenames.

◆ get_leftmost_data_value_from_tree()

get_leftmost_data_value_from_tree ( self,
xpath_query,
my_tree,
type = str )

Retrieves the first (leftmost) data_value matching the XPath query in the given ETree.

◆ get_leftmost_data_values_from_database()

get_leftmost_data_values_from_database ( self,
xpath_query,
type = str )

Retrieves list of leftmost data_values matching the XPath query over all the ETrees of the database (one leftmost data_value per ETree).

◆ get_rightmost_data_value_from_tree()

get_rightmost_data_value_from_tree ( self,
xpath_query,
my_tree,
type = str )

Retrieves the last (rightmost) data_value matching the XPath query in the given ETree.

◆ get_rightmost_data_values_from_database()

get_rightmost_data_values_from_database ( self,
xpath_query,
type = str )

Retrieves list of rightmost data_values matching the XPath query over all the ETrees of the database (one lrightmost data_value per ETree).

◆ is_data_value_in_tree()

is_data_value_in_tree ( self,
xpath_query,
my_tree,
data_value,
type = str )

Is the given data_value pointed by the given Xpath query.

◆ load_from_directory()

load_from_directory ( self,
input_dir,
regex = "",
subdirs = False )

Parse the input directory, possibly filter the filenames, and build one ETree for each file retained.

◆ sort_databases()

sort_databases ( self,
varname,
type = str,
options_suffix = "__options.xml" )

Sorts input databases by looking for each of them its corresponding options.xml file, and sorting following the value of the described option.