movers_utils¶
Auxiliary functions for Custom PyRosetta Movers and to read database files into memory.
Functions¶
|
Read a database file into a pandas DataFrame. |
|
Removes columns in a database whose names are not in a given list. |
|
Reduce a database's memory usage to what is strictly necessary. |
|
Setup the databases the movers can access during sampling of dihedral angles. |
|
Return the allowed range for the phi and psi angle values of a given secondary structure. |
Module Contents¶
- ensemblify.generation.ensemble_utils.movers_utils.read_database(database_path)¶
Read a database file into a pandas DataFrame.
If possible, read only the desired set of columns into a pandas.DataFrame (depends on database file format).
- Parameters:
database_path (
str) – Filepath to database file.- Returns:
Database as a pandas.DataFrame.
- Return type:
pd.DataFrame
- ensemblify.generation.ensemble_utils.movers_utils.trim_database(database, columns_to_keep)¶
Removes columns in a database whose names are not in a given list.
Modifies the database in place.
- Parameters:
database (
pd.DataFrame) – Target database in DataFrame format.columns_to_keep (
list[str]) – Column names to keep in the database.
- ensemblify.generation.ensemble_utils.movers_utils.optimize_database(database)¶
Reduce a database’s memory usage to what is strictly necessary.
Datatypes of database’s columns are optimized and database is broken into 20 pieces, one for each aminoacid residue.
- Parameters:
database (
pd.DataFrame) – Unoptimized dihedral angle database.- Returns:
Mapping of aminoacid 1lettercode to their corresponding dihedral angle values in the optimized database.
- Return type:
dict[str,pd.DataFrame]
- ensemblify.generation.ensemble_utils.movers_utils.setup_databases(databases_paths)¶
Setup the databases the movers can access during sampling of dihedral angles.
Databases are read into memory, trimmed into only necessary columns and optimized to use the least amount of memory possible.
- Parameters:
databases_paths (
dict[str,str]) – Mapping of database_ids to filepaths where the specified databases are stored.- Returns:
Mapping of database_ids to mappings of aminoacid 1lettercode to their corresponding dihedral angle values in the optimized database.
- Return type:
dict[str,dict[str,pd.DataFrame]]
- ensemblify.generation.ensemble_utils.movers_utils.get_ss_bounds(secondary_structure)¶
Return the allowed range for the phi and psi angle values of a given secondary structure.
- Parameters:
secondary_structure (
str) – Identifier for a protein secondary structure.- Returns:
- phi_bounds (tuple[int,int]):
Tuple with the lower and upper bounds for phi dihedral angle values for the secondary structure in question.
- psi_bounds (tuple[int,int]):
Tuple with the lower and upper bounds for psi dihedral angle values for the secondary structure in question.
- Return type:
tuple[tuple[int,int],tuple[int,int]]