Source code for schrodinger.application.phase.constants

"""
Module defining Phase-related constants that are shared between scripts and
other modules.
"""

from schrodinger.infra import phase

# Binding site cutoff distance from any ligand atom to any receptor atom used
# by the phase_denovo_pharm backend
DEFAULT_DENOVO_BINDING_SITE_CUTOFF = 6.0

# Last used feature definition file used in the Develop Pharmacophore Model
# panel, which will get automatically loaded if available.
PROJECT_LAST_SAVED_FD_FILE = "last_saved_feature.ini"

# Constants for pharmacophore feature types
FEATURE_A = phase.FEATURE_TYPE_ACCEPTOR
FEATURE_D = phase.FEATURE_TYPE_DONOR
FEATURE_H = phase.FEATURE_TYPE_HYDROPHOBIC
FEATURE_N = phase.FEATURE_TYPE_NEGATIVE_IONIC
FEATURE_P = phase.FEATURE_TYPE_POSITIVE_IONIC
FEATURE_Q = phase.FEATURE_TYPE_PROJECTED
FEATURE_R = phase.FEATURE_TYPE_AROMATIC
FEATURE_X = phase.FEATURE_TYPE_CUSTOM_X
FEATURE_Y = phase.FEATURE_TYPE_CUSTOM_Y
FEATURE_Z = phase.FEATURE_TYPE_CUSTOM_Z

# List of standard feature types
STD_FEATURE_TYPES = (FEATURE_A, FEATURE_D, FEATURE_H, FEATURE_N, FEATURE_P,
                     FEATURE_R)
# List of custom feature types
CUSTOM_FEATURE_TYPES = (FEATURE_X, FEATURE_Y, FEATURE_Z)
# List of all available feature types, including custom ones
FEATURE_TYPES = STD_FEATURE_TYPES + CUSTOM_FEATURE_TYPES

# Site mask value for 'matching is optional'
MASK_PERMITTED = 0
# Site mask value for 'site must match'
MASK_REQUIRED = 1
# Site mask value for 'site cannot be matched'
MASK_DISABLED = -1

# Dictionary that maps mask name to its value
MASK_NAMES = {
    "Permitted": MASK_PERMITTED,
    "Required": MASK_REQUIRED,
    "Disabled": MASK_DISABLED
}

GROUPED_MASK_NAME = "Grouped"

# Colors for each feature type (tuple of 0-1 RGB values) used for
# pharmacophore markers in the Workspace.
FEATURE_COLORS = {
    FEATURE_A: (1.0, 0.5, 0.5),
    FEATURE_D: (0.5, 0.8, 0.9),
    FEATURE_H: (0.3, 1.0, 0.3),
    FEATURE_N: (1.0, 0.3, 0.3),
    FEATURE_P: (0.5, 0.6, 1.0),
    FEATURE_Q: (1.0, 0.0, 1.0),
    FEATURE_R: (0.92, 0.51, 0.2),
    FEATURE_X: (0.0, 1.0, 1.0),
    FEATURE_Y: (0.3, 0.0, 1.0),
    FEATURE_Z: (1.0, 0.0, 1.0),
}

# Colors for feature names used in feature grid widget. They are made somewhat
# different from feature colors in the workspace since feature text appears
# against light background. This way feature text becomes more visible and
# looks more similar to the Workspace colors.
FEATURE_TEXT_COLORS = {
    FEATURE_A: (0.8, 0.4, 0.4),
    FEATURE_D: (0.392, 0.624, 0.698),
    FEATURE_H: (0.2, 0.671, 0.2),
    FEATURE_N: (0.702, 0.169, 0.169),
    FEATURE_P: (0.376, 0.451, 0.749),
    FEATURE_R: (0.8, 0.447, 0.176),
    FEATURE_X: (0.0, 1.0, 1.0),
    FEATURE_Y: (0.3, 0.0, 1.0),
    FEATURE_Z: (1.0, 0.0, 1.0),
}

# Color for 'selected' feature (cyan)
SELECTED_FEATURE_COLOR = (0.0, 1.0, 1.0)

# For excluded volume spheres in the workspace
XVOL_PICK_CATEGORY = "xvol_pick_category"

# Properties which directly encode Phase hypothesis data
base64_properties = [
    phase.PHASE_CONSTRAINTS, phase.PHASE_EXCLUDED_VOLUMES,
    phase.PHASE_FEATURE_DEFINITIONS, phase.PHASE_FEATURE_RADII,
    phase.PHASE_FEATURE_RULES, phase.PHASE_INCLUDED_VOLUMES,
    phase.PHASE_MATCHING_TOLERANCES, phase.PHASE_QSAR_MODEL, phase.PHASE_REF_CT,
    phase.PHASE_SITE_MASK, phase.PHASE_SITES, phase.PHASE_SITES_WITH_PROJ
]

# Hypothesis roles not delegated to ROLE_HYPO and ROLE_REF
ADDITIONAL_ROLE = [
    phase.ROLE_ACTIVE, phase.ROLE_INACTIVE, phase.ROLE_TRAIN, phase.ROLE_TEST
]

# Ligand group specific properties utilized by the phase_hypothesis driver
IMPORTED_PHARM_SET = "s_phase_Imported_Pharm_Set"
IMPORTED_MUST_MATCH = "b_phase_Imported_Must_Match"
IMPORTED_LIGAND_GROUP = "i_phase_Imported_Ligand_Group"

# Defines whether components associated with the hypothesis are visible.
HYPO_XVOL_VISIBLE = "b_phasehypo_ExcludedVolumesVisible"
HYPO_REFCT_VISIBLE = "b_phasehypo_ReferenceLigandVisible"
HYPO_TOL_VISIBLE = "b_phasehypo_ToleranceVisible"
FEATURE_LABELS_VISIBLE = "b_phasehypo_FeatureLabelsVisible"
PROP_LABELS_VISIBLE = "b_phasehypo_PropLabelsVisible"
# Defines whether manage excluded volumes panel is open for the given entry.
MANAGE_XVOL_OPEN = "b_phasehypo_ManageXvolOpen"

# Shape data files extention (to be used in file dialogs)
SHAPES_FILE_EXT = ['*.bin']


[docs]def get_feature_text(feature_type): """ This function returns a string that shows both one letter feature type as well as a long name. :param feature_type: single character feature type :type feature_type: str :return: feature text string :rtype: str """ return "(%s) %s" % (feature_type, phase.FEATURE_DESCRIPTION[feature_type])
[docs]def FEATURE_QCOLORS(feature_type): """ Colors for each feature type, as QColor objects. These colors are used to show text labels etc, so we are using FEATURE_TEXT_COLORS instead of FEATURE_COLORS. :param feature_type: single character feature type :type feature_type: str :return: Feature text QColor for the given feature type :rtype: `QtGui.QColor` """ from schrodinger.Qt.QtGui import QColor qcolor = QColor() qcolor.setRgbF(*FEATURE_TEXT_COLORS[feature_type]) return qcolor
[docs]def PICK_CATEGORY(): import schrodinger.ui.maestro_ui as maestrolibs return maestrolibs.mm_get_phase_marker_picking_category()