schrodinger.application.phase.shape_screen_reporter.task_utils module¶
Performs task-based work for generating and using shape screen report databases.
Copyright Schrodinger LLC, All Rights Reserved.
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
check_user_query
(reporter, user_features, user_tol=None, user_rules=None)[source]¶ Returns a non-empty error message if any of the supplied query data are illegal.
- Parameters
reporter (phase.PhpShapeScreenReporter) – Connection to a shape screen report database
user_features – Feature names with 1-based numbering, e.g., [‘A1’, ‘D5’, ‘H9’, ‘R12’]
user_tol (dict{str, float} or NoneType) – Dictionary of <feature>:<tol> pairs, where <feature> consists of a feature name and <tol> is the matching tolerance, e.g., {‘A1’: 1.5, ‘R12’, 2.5}.
user_rules (dict{str, str} or NoneType) – Dictionary of <feature>:<permitted> pairs, where <feature> consists of a feature name and <permitted> contains the first character of <feature>, followed by any other types <feature> is allowed to match, e.g., {‘A1’:’AN’, ‘R12’:’RH’}
- Returns
Non-empty error message if any data are invalid
- Return type
str
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
cluster_hits
(args, logger=None, zip_hypos=True)[source]¶ Clusters hits in a shape screen report database according to the query sites they match.
- Parameters
args (argparser.Namespace) – argparser.Namespace with command line arguments
logger (logging.Logger) – Logger for info level output
zip_hypos (bool) – Whether to place any created hypotheses in the zip archive <jobname>_hypos.zip
- Returns
Dictionary of matched features –> cluster size
- Return type
dict{string: int}
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
create_cluster_hypo
(reporter, subset=None, user_tol=None, user_rules=None)[source]¶ Constructs a pharmacophore hypothesis from the shape query for use in the “cluster” task. All shape query sites are used to perform the initial clustering, whereas a subset of sites are used the create the hypothesis for a particular cluster. Positional tolerances and feature-matching rules in the hypothesis are modified according to dictionaries that contain any user-specified <feature>:<tol> and <feature>:<permitted> pairs, where <feature> consists of only a feature type, with no number.
- Parameters
reporter (phase.PhpShapeScreenReporter) – Connection to a shape screen report database
subset (list(int) or NoneType) – Zero-based list of query site numbers. All sites are used by default.
user_tol (dict{str, float} or NoneType) – Dictionary of <feature>:<tol> pairs, where <feature> consists of only a feature type and <tol> is the matching tolerance, e.g., {‘A’: 1.5, ‘R’, 2.5}.
user_rules (dict{str, str} or NoneType) – Dictionary of <feature>:<permitted> pairs, where <feature> consists of only a feature type and <permitted> contains <feature>, followed by any other types <feature> is allowed to match, e.g., {‘A’:’AN’, ‘H’:’HR’, ‘R’:’RH’}
- Returns
The requested pharmacophore hypothesis
- Return type
phase.PhpHypoAdaptor
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
create_database
(args, logger=None)[source]¶ Creates a new shape screen report database.
- Parameters
args (argparser.Namespace) – argparser.Namespace with command line arguments
logger (logging.Logger) – Logger for info level output
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
create_user_hypo
(reporter, user_features, user_tol=None, user_rules=None)[source]¶ Constructs a pharmacophore hypothesis from the shape query based on a list of feature names supplied by the user. Positional tolerances and feature-matching rules in the hypothesis are modified according to dictionaries that contain any user-specified <feature>:<tol> and <feature>:<permitted> pairs, where <feature> consists of a feature type followed by a 1-based feature number.
- Parameters
reporter (phase.PhpShapeScreenReporter) – Connection to a shape screen report database
user_features (list(str)) – Feature names with 1-based numbering, e.g., [‘A1’, ‘D5’, ‘H9’, ‘R12’]
user_tol (dict{str, float} or NoneType) – Dictionary of <feature>:<tol> pairs, where <feature> consists of a feature name and <tol> is the matching tolerance, e.g., {‘A1’: 1.5, ‘R12’, 2.5}.
user_rules (dict{str, str} or NoneType) – Dictionary of <feature>:<permitted> pairs, where <feature> consists of a feature name and <permitted> contains the first character of <feature>, followed by any other types <feature> is allowed to match, e.g., {‘A1’:’AN’, ‘R12’:’RH’}
- Returns
The requested pharmacophore hypothesis
- Return type
phase.PhpHypoAdaptor
- Raise
ValueError if any of the supplied feature names is illegal or not found in the shape query, or if any of the tolerances or permitted feature strings is illegal.
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
export_hits_or_hypo
(args, logger=None)[source]¶ Exports hits and/or hypothesis for a subset of query features.
- Parameters
args (argparser.Namespace) – argparser.Namespace with command line arguments
logger (logging.Logger) – Logger for info level output
- Raise
ValueError if any of the feature names, feature tolerances or feature rules are illegal.
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
get_feature_overlap_mappings
(base_features_hit, base_features_query, result)[source]¶ Constructs a list of FeatureOverlapMapping objects from the base features of the hit, the base features of the query and the PhpShapeScreenResult from screening the hit against the query.
- Parameters
base_features_hit (list(phase.PhpBaseFeature)) – All base features in the hit
base_features_query (list(phase.PhpBaseFeature)) – All base features in the query
result (phase.PhpShapeScreenResult) – The result from screening the hit against the query
- Returns
List of FeatureOverlapMapping objects
- Return type
list(canvas2d.FeatureOverlapMapping)
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
get_jobname
(dbfile, task)[source]¶ Determines the job name from SCHRODINGER_JOBNAME or from the base name of the shape screen report database and the task.
- Parameters
dbfile (str) – Shape screen report database file
task (str) – The task being performed
- Returns
Job name
- Return type
str
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
get_structures
(reporter, rows, max_in_memory=1000)[source]¶ Generator that yields structures from a shape screen report database while limiting the number of structures held in memory.
- Parameters
reporter (phase.PhpShapeScreenReporter) – Connection to a shape screen report database
rows (list(int)) – The rows to read. Row 0 corresponds to the shape query, while rows 1, 2, etc. correspond to the hits. Rows may be in any order.
max_in_memory (int) – The maximum number of structures that will be held in memory while reading
- Yield
The next structure in the list of rows
- Ytype
structure.Structure
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
print_images
(images, ncols, pdf_file, page_size=<PageSize.Letter: 1>)[source]¶ Prints a list of images to a table in PDF format.
- Parameters
images (list(report2d.StructInfo)) – List of images.
ncols (int) – Number of columns in table
pdf_file (str) – Name of PDF file
page_size (option_utils.PageSize) – Page size
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
print_report
(args, logger=None)[source]¶ Generates a PDF file containing a table of annotated 2D hits that match a set of features in the shape query. Must construct a QApplication before calling this function.
- Parameters
args (argparser.Namespace) – argparser.Namespace with command line arguments
logger (logging.Logger) – Logger for info level output
- Raise
ValueError if any of the feature names, feature tolerances or feature rules are illegal.
-
schrodinger.application.phase.shape_screen_reporter.task_utils.
setup_screen
(reporter, features, tol, rules)[source]¶ Creates a pharmacophore hypothesis from user-supplied strings of features, tolerances and feature-matching rules.
- Parameters
reporter (phase.PhpShapeScreenReporter) – Connection to a shape screen report database
features (str or NoneType) – String containing a comma-delimited list of query features to match. If None, all features in the query will be used.
tol (str) – String containing a dictionary-like specification of matching tolerances
rules (str) – String containing a dictionary-like specification of feature type matching rules
- Returns
The pharmacophore hypothesis with which to perform the screen
- Return type
phase.PhpHypoAdaptor
- Raise
ValueError if any of the supplied feature names is illegal or not found in the shape query, or if any of the tolerances or permitted feature strings is illegal.