icolos.core.containers package#

Submodules#

icolos.core.containers.compound module#

class icolos.core.containers.compound.Compound(name: str = '', compound_number: Optional[int] = None)[source]#

Bases: object

This class bundles all information on a molecule and serves mainly to group enumerations.

add_enumeration(enumeration: Enumeration, auto_update: bool = True)[source]#

Add a new enumeration. If “auto_update” is True, the Compound class will be set to “self” and the enumeration_id will be set to the next free index.

add_enumerations(enumerations: List[Enumeration], auto_update: bool = True)[source]#

Add new enumerations. If “auto_update” is True, the Compound class will be set to “self” and the enumeration_id will be set to the next free index.

clear_enumerations()[source]#
empty() bool[source]#
find_enumeration(enumeration_id: int) Enumeration[source]#
get_compound_number() int[source]#
get_enumeration_ids() List[int][source]#
get_enumerations() List[Enumeration][source]#
get_index_string() str[source]#
get_name() str[source]#
reset_all_ids()[source]#
reset_enumeration_ids()[source]#
set_compound_number(compound_number: int)[source]#
set_name(name: str)[source]#
unroll_conformers() List[Conformer][source]#
update_all_relations()[source]#
class icolos.core.containers.compound.Conformer(conformer: Optional[Mol] = None, conformer_id: Optional[int] = None, enumeration_object=None)[source]#

Bases: object

This class is a storage class for individual conformers associated with a given Enumeration.

add_extra_data(key: str, data)[source]#
clear_extra_data()[source]#
empty() bool[source]#
get_compound_name() str[source]#
get_conformer_id() int[source]#
get_enumeration_object()[source]#
get_extra_data() dict[source]#
get_index_string() str[source]#
get_molecule() Mol[source]#
set_conformer_id(conformer_id: int)[source]#
set_enumeration_object(enumeration_object)[source]#
set_molecule(conformer: Mol)[source]#
update_coordinates(path: str)[source]#
write(path: str, format_='sdf')[source]#
class icolos.core.containers.compound.Enumeration(compound_object=None, smile: str = '', molecule: Optional[Mol] = None, original_smile: Optional[str] = None, enumeration_id: Optional[int] = None)[source]#

Bases: object

This class bundles all information on an enumeration, especially all conformers generated.

add_conformer(conformer: Conformer, auto_update: bool = True)[source]#

Add a new conformer. If “auto_update” is True, the Enumeration class will be set to “self” and the conformer_id will be set to the next free index.

add_conformers(conformers: List[Conformer], auto_update: bool = True)[source]#

Add new conformers. If “auto_update” is True, the Enumeration class will be set to “self” and the conformer_id will be set to the next free index.

clean_failed_conformers()[source]#
clear_conformers()[source]#
clear_molecule()[source]#
clone_conformers() List[Conformer][source]#
empty() bool[source]#
find_conformer(conformer_id: int) Conformer[source]#
get_compound_name() str[source]#
get_compound_object()[source]#
get_conformer_ids() List[int][source]#
get_conformers() List[Conformer][source]#
get_enumeration_id() int[source]#
get_index_string() str[source]#
get_molecule() Mol[source]#
get_original_smile() str[source]#
get_smile() str[source]#
reset_conformer_ids()[source]#
set_compound_object(compound_object)[source]#
set_enumeration_id(enumeration_id: int)[source]#
set_molecule(molecule: Mol)[source]#
set_original_smile(original_smile: str)[source]#
set_smile(smile: str)[source]#
sort_conformers(by_tag: Union[str, List[str]], reverse: bool = True, aggregation='sum')[source]#
icolos.core.containers.compound.get_compound_by_id(compounds: List[Compound], id: int) Compound[source]#
icolos.core.containers.compound.get_compound_by_name(compounds: List[Compound], name: str) Compound[source]#
icolos.core.containers.compound.unroll_conformers(compounds: List[Compound]) List[Conformer][source]#
icolos.core.containers.compound.unroll_enumerations(compounds: List[Compound]) List[Enumeration][source]#

icolos.core.containers.generic module#

class icolos.core.containers.generic.GenericContainer[source]#

Bases: object

Container class to hold the instances of the Generic class, separated by extension

add_file(file: GenericData)[source]#
add_files(files: List[GenericData])[source]#
clear_file_dict()[source]#
get_all_files() Dict[str, List][source]#
get_argument_by_extension(ext, rtn_file_object=False) Union[GenericData, str][source]#
get_file_by_index(index)[source]#
get_file_by_name(name)[source]#
get_file_names_by_extension(ext: str)[source]#
get_file_types()[source]#
get_files_by_extension(ext: str) List[Optional[GenericData]][source]#
get_flattened_files() List[GenericData][source]#
get_next_file_id(ext)[source]#
write_out_all_files(folder)[source]#

flattens all files in the container and writes to the specified directory

class icolos.core.containers.generic.GenericData(file_name: str, file_data=None, argument=True, file_id: Optional[int] = None, extension: Optional[str] = None)[source]#

Bases: object

Container class to hold generic data of any file type

calculate_file_size()[source]#
get_data() Any[source]#
get_extension()[source]#
get_file_name() str[source]#
get_id()[source]#
set_data(data)[source]#
set_extension(extension)[source]#
set_file_name(file_name)[source]#
set_id(file_id)[source]#
update_data(data)[source]#
write(path: str, join: bool = True, final_writeout: bool = False)[source]#

Handles all I/O operations for generic data. Support for handling directories and symlinks

icolos.core.containers.gmx_state module#

class icolos.core.containers.gmx_state.AtomType(*, number: int, a_type: str, resi: int, res: str, atom: str, cgnr: int, charge: float, mass: float)[source]#

Bases: BaseModel

a_type: str#
atom: str#
cgnr: int#
charge: float#
mass: float#
number: int#
res: str#
resi: int#
class icolos.core.containers.gmx_state.GromacsState(*, top_lines: List = [], itps: Dict = {}, posre: Dict = {}, atomtypes: List = [], chains: List = None, forcefield: str = 'amber03', water: str = 'tip3p', system: List = [], molecules: Dict = {}, structures: Dict = {}, tprs: Dict = {}, trajectories: Dict = {}, log: Dict = {}, edr: Dict = {}, cpt: Dict = {}, ndx: List = [], properties: Dict[str, List] = {})[source]#

Bases: BaseModel

class Config[source]#

Bases: object

arbitrary_types_allowed: True#
add_itp(path, files: List[str], gen_posre: bool = True) None[source]#
add_molecule(name: str, num: int = 1)[source]#
add_posre(path, files: List[str]) None[source]#
append_structure(path: str, file: str, sanitize=False, index: int = 0) None[source]#
atomtypes: List#
chains: List#
collect_atomtypes() List[source]#

Iterate over the itp files, strip any newly defined atomtypes, append to their own atomtypes.itp file, include this just after the forcefield include

cpt: Dict#
edr: Dict#
forcefield: str#
generate_base_topol_file()[source]#

Generates the main topology file

generate_posre(path: str, itp_file: str, force: int = 1000)[source]#
itps: Dict#
log: Dict#
molecules: Dict#
ndx: List#
parse(path: str, file: str = 'topol.top')[source]#

Populate the fields from parsing a topol file (normally from gmx pdb2gmx) If a moleculetype has been defined in a single topology, this is separated into its own itp file

posre: Dict#
properties: Dict[str, List]#
set_cpt(path: str, file: str = 'state.cpt', index: int = 0)[source]#
set_edr(path: str, file: str = 'ener.edr', index: int = 0)[source]#
set_log(path: str, file: str = 'md.log', index: int = 0)[source]#
set_ndx(path: str, file: str = 'index.ndx')[source]#
set_structure(path: str, file: str = 'confout.gro', sanitize=False, index: int = 0)[source]#
set_topol(path: str, file: str = 'topol.top')[source]#

When solvate or genion produce a modified topol, read this into the topology lines

set_tpr(path: str, file: str = 'topol.tpr', index: int = 0)[source]#
set_trajectory(path: str, file: str = 'traj.xtc', index: int = 0)[source]#
structures: Dict#
system: List#
top_lines: List#
tprs: Dict#
trajectories: Dict#
water: str#
write_cpt(path: str, file: str = 'state.cpt', index: int = 0)[source]#
write_edr(path: str, file: str = 'ener.edr', index: int = 0)[source]#
write_log(path: str, file: str = 'md.log', index: int = 0)[source]#
write_ndx(path: str, file: str = 'index.ndx')[source]#
write_props(path: str)[source]#

writes summary of properties for all trajectories to a file

write_structure(path: str, file: str = 'confout.gro', index: int = 0)[source]#
write_topol(base_dir: str, file: str = 'topol.top')[source]#

Write a gromacs topology file, including its dependent itp files, to a dir

write_tpr(path: str, file: str = 'topol.tpr', index: int = 0)[source]#
write_trajectory(path: str, file: str = 'traj.xtc', index: int = 0)[source]#

icolos.core.containers.perturbation_map module#

class icolos.core.containers.perturbation_map.Edge(*, node_from: Node = Node(node_id=None, node_hash=None, conformer=None, node_connectivity=[]), node_to: Node = Node(node_id=None, node_hash=None, conformer=None, node_connectivity=[]), total: str = None, mcs: str = None, chg: str = None, softbond: str = None, min_no_atoms: str = None, snapCoreRmsd: str = None, bidirSnapCoreRmsd: str = None, status: ParallelizationEnum = ParallelizationEnum.STATUS_SUCCESS, ddG: float = 0.0, ddG_err: float = 0.0)[source]#

Bases: BaseModel

class Config[source]#

Bases: object

arbitrary_types_allowed = True#
bidirSnapCoreRmsd: str#
chg: str#
ddG: float#
ddG_err: float#
get_edge_id() str[source]#
mcs: str#
min_no_atoms: str#
node_from: Node#
node_to: Node#
snapCoreRmsd: str#
softbond: str#
status: ParallelizationEnum#
total: str#
class icolos.core.containers.perturbation_map.Node(*, node_id: str = None, node_hash: str = None, conformer: Conformer = None, node_connectivity: List = [])[source]#

Bases: BaseModel

class Config[source]#

Bases: object

arbitrary_types_allowed = True#
conformer: Optional[Conformer]#
get_conformer() Conformer[source]#
get_node_color()[source]#
get_node_hash() str[source]#
get_node_id() str[source]#
node_connectivity: List#
node_hash: str#
node_id: str#
set_conformer(conformer: Conformer) None[source]#
set_node_id(node_id: str)[source]#
class icolos.core.containers.perturbation_map.PerturbationMap(*, nodes: List[Node] = [], edges: List[Edge] = [], hash_map: Dict = {}, compounds: List[Compound] = [], protein: GenericData = None, vmap_output: IFrame = None, replicas: int = 3, node_df: DataFrame = None, strict_execution: str = False, hub_conformer: Conformer = None)[source]#

Bases: BaseModel

Hold a map construction parsed from a csv (probabably from a parsed schrodinger log file or something) and provide some utility methods for doing pmx calculations on the edges

class Config[source]#

Bases: object

arbitrary_types_allowed = True#
add_edge(edge: Edge) None[source]#
add_node(node: Node) None[source]#
compounds: List[Compound]#
edges: List[Edge]#
generate_from_lomap_output(file: str)[source]#
generate_star_map() None[source]#

Generates a star topology using a single hub compound

get_edge_by_id(id: str) Optional[Edge][source]#

Lookup edge by identifier

Parameters:

id (str) – edge hash to retrieve

Return Optional[Edge]:

Return the edge if found, else None

get_edges(alive_only=True) List[Edge][source]#
get_nodes() List[Node][source]#
get_protein() GenericData[source]#
hash_map: Dict#
hub_conformer: Conformer#
node_df: DataFrame#
nodes: List[Node]#
parse_map_file(file_path: str) None[source]#

Parse map from Schrodinger’s fep_mapper log file, build internal graph representation + attach properties from fmp_stats, if provided

Parameters:

file_path (str) – path to the fep_mapper.log file to extract the perturbation map from

protein: GenericData#
replicas: int#
strict_execution: str#
visualise_perturbation_map(write_out_path: str) None[source]#

Generate NetworkX graph for the parsed perturbation map

Parameters:

write_out_path (str) – directory to write output file

vmap_output: IFrame#

Module contents#