schrodinger.application.bioluminate.propfilter module¶
This contains a QDialog class that allows the user to define criteria to filter properties by.
It also contains classes that hold the criteria and determine if properties match the criteria.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.bioluminate.propfilter.
BooleanDatabaseCriterion
(dataname, username, criteria, joiner='')¶ Bases:
schrodinger.application.bioluminate.propfilter.StringDatabaseCriterion
-
checkForMatch
(obj_val, operator, goal=None, isCaseSensitive=None)¶ - Check to see if a value matches this criterion. Returns True if::
- “obj_val operator” (“Schrodinger is True” returns True)
Parameters: - obj_val (int or float) – The value being checked
- operator (int or float) – An operator as defined in the
__init__
method of theStringDatabaseCriterion
class criteria paramater. - goal – Not used, none of the Boolean operators requires a value to compare against.
- isCaseSensitive – ignored (added for compatibility with base class)
Return type: bool
Returns: True if “obj_val operator” is True, False if not
Raises: ValueError – if operator is not recognized
-
-
class
schrodinger.application.bioluminate.propfilter.
CriteriaListModel
¶ Bases:
PyQt5.QtCore.QAbstractListModel
Class for storing the criteria list information.
-
addLine
(line, linetype=None)¶
-
clear
()¶
-
data
(index, role=0)¶ Given a cell index, returns the data that should be displayed in that cell (text or check button state). Used by the view.
-
flags
(index)¶ Returns flags for the specified cell. Whether selectable or not.
-
rowCount
(parent=<PyQt5.QtCore.QModelIndex object>)¶ Returns number of rows
-
-
class
schrodinger.application.bioluminate.propfilter.
NumericalDatabaseCriterion
(dataname, username, criteria, joiner='')¶ Bases:
schrodinger.application.bioluminate.propfilter.StringDatabaseCriterion
-
checkForMatch
(obj_val, operator, goal, isCaseSensitive=None)¶ - Check to see if a value matches this criterion. Returns True if::
- “obj_val operator goal” (“20 >= 10” returns True)
Parameters: - obj_val (int or float) – The value being checked
- operator (int or float) – An operator as defined in the
__init__
method of theStringDatabaseCriterion
class criteria paramater. - goal (int, float or list) – The value to compare against, or in the case of the SELECT operator, goal is a list of int or float
- isCaseSensitive – ignored (added for compatibility with base class)
Return type: bool
Returns: True if “obj_val operator goal” is True, False if not
Raises: ValueError – if operator is not recognized
-
-
class
schrodinger.application.bioluminate.propfilter.
PropFilterDialog
(parent, criteria=None, databases=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Panel to allow the user to define criteria for filtering property values
-
accept
()¶ Add the selected criteria to the parent - calls parent.setCriteria() with a list of
StringDatabaseCriterion
,NumericalDatabaseCriterion
andBooleanDatabaseCriterion
objects
-
addCriterion
()¶ Adds a criterion when the user hits the Add button
-
checkPropertyType
(prop)¶ Callback for modifications to the property QLineEdit. Adjust the operator list and value validator according to the property type entered.
Parameters: prop (str) – The current value of the property QLineEdit
-
convertToClassToken
(s)¶ This function converts given string to one of class tokens (either ‘Light’, ‘Heavy’ or ‘Misc’). Valid ‘light’ and ‘heavy’ strings are defined in light and heavy variables respectively.
Parameters: s (str) – property class string Returns: class token Return type: str
-
deleteEntry
()¶ Delete the selected criterion or pattern
-
filterSelectionChanged
(selected=None, deselected=None)¶ Enables or disables the Delete button as appropriate depending on the selection in the Criteria display area
Parameters: - selected – Unused
- deselected – Unused
-
findCommonDatanames
(databases)¶ This function find column names that are present in all databases.
Parameters: databases (list) – List of the databases to load data from. Returns: list of common column names Return type: list
-
getCumulativeMatches
()¶
-
getPropertyMinMax
(property)¶ Get the min and max values of property from the database.
Parameters: property (str) – The name of a database property to get the min and max of Return type: list Returns: [min, max] of property. Returns [None, None] if the database is not defined.
-
joinerChanged
(result)¶ Enable/disable the second criteria widgets as appropriate for the joiner (“”, AND, OR) that the user just selected.
Parameters: result (str) – The current value selected in the joiner combobox
-
letUserSelectValues
(propmenu, value_edit)¶ Open a
ValueSelectionDialog
to allow the user to select values of the property that will match the criterion.Parameters: - propmenu (QComboBox or object with setCurrentIndex method) – The cancel method of the dialog sets propmenu.setCurrentIndex(0)
- value_edit – value_edit is passed to
setSelectedValues
in the accept method of the dialog
-
loadDatabases
(databases)¶ Load in the data from the database - populates the upper text box with property names. Adds Misc, Light, or Heavy to property names so the user can filter them by class.
Parameters: database ( schrodinger.application.prime.packages.PrimeStructureDatabase.PrimeStructureDB
) – The database to load data from
-
operater2Changed
(result)¶ Disable/enable the value edit as appropriate for the selected operator. Opens a
ValueSelectionDialog
if the operator is SELECT.Parameters: result (str) – The current value in the 2nd operator combobox
-
operator1Changed
(result)¶ Disable/enable the value edit as appropriate for the selected operator. Opens a
ValueSelectionDialog
if the operator is SELECT.Parameters: result (str) – The current value in the 1st operator combobox
-
selectProperty
()¶ Populate the property name edit with the property name of the property the user just selected.
-
setDefaults
(criteria=None)¶ Set the panel defaults
Parameters: criteria (list) – Pre-existing StringDatabaseCriterion
,NumericalDatabaseCriterion
andBooleanDatabaseCriterion
objects that should be added the criterion area
-
setProperties
(property_names)¶ Set the list of properties the user can choose from.
Parameters: property_names (list of schrodinger.structure.PropertyName
) – Each item of the list is aschrodinger.structure.PropertyName
object for a property that the user can select from
-
setSelectedValues
(values, value_edit)¶ Called by
ValueSelectionDialog
to set the text in the proper value_edit to the values the user selected.Parameters: - values (list) – list of values selected by the user
- value_edit (QLineEdit) – The edit that values should be placed in
-
updateText
()¶ Rewrite the text in the criteria text box
-
-
class
schrodinger.application.bioluminate.propfilter.
PropertySelectorWithRanges
(master, *args, **kwargs)¶ Bases:
schrodinger.ui.qt.propertyselector.PropertySelector
A PropertySelector class that appends ranges to the names of numeric properties.
-
checkUserNames
()¶ Assigns PropertyName.user_name attributes, for all members in self.proplist. The user_names are unique within the PropertySelector instance.
The user_name strings are typically just the PropertyName.userName(), but may be modified with a numerical suffix to make them unique, or decorated with the family name (which does not garuntee uniqeness, but may make the items easier for the end user to visually group).
-
-
class
schrodinger.application.bioluminate.propfilter.
SelectingFilteredListWidget
(label=None, filterlabel='Filter:', filter='within', filterside='bottom', case=False, **kwargs)¶ Bases:
schrodinger.ui.qt.swidgets.SFilteredListWidget
A QListWidget that contains a edit to allow the user to filter the contents of the widget. If a filter is being applied, all the matching contents are selected.
-
class
schrodinger.application.bioluminate.propfilter.
StringDatabaseCriterion
(dataname, username, criteria, joiner='')¶ Bases:
object
Holds a criterion for a string property and determines whether a database object or structure meets that criterion
-
checkForMatch
(obj_val, operator, goal, isCaseSensitive=False)¶ - Check to see if a value matches this criterion. Returns True if::
- “obj_val operator goal” (“Schrodinger contains odin” returns True)
Parameters: Return type: bool
Returns: True if “obj_val operator goal” is True, False if not
Raises: ValueError – if operator is not recognized
-
matches
(dbobj=None, struct=None, stem='bioluminate', isCaseSensitive=False)¶ Checks to see if a
schrodinger.application.prime.packages.PrimeStructureDatabase.PrimeStructureDBEntry
database object or aschrodinger.structure.Structure
object matches this Criterion.Parameters: - dbobj (
schrodinger.application.prime.package.PrimeStructureDatabase.PrimeStructureDBEntry
) – The database object to check for a match. Only dbobj or struct should be provided, but not both. If both are provided, the struct object is checked and the dbobj is ignored. - struct (
schrodinger.structure.Structure
) – The Structure object to check for a match. Only dbobj or struct should be provided, but not both. If both are provided, the struct object is checked and the dbobj is ignored. - stem (str) – If given, this value will be inserted at the beginning of the second part of the Criterion property name when checking a struct object. Property x_y_z will become x_stemy_z. Default is ‘bioluminate’. This is done because the database removes stem from property names when storing data.
Return type: bool
Returns: True if the provided object passes this Criterion, False if not.
- dbobj (
-
-
class
schrodinger.application.bioluminate.propfilter.
ValueSelectionDialog
(parent, values, propmenu, value_edit)¶ Bases:
PyQt5.QtWidgets.QDialog
A SFilteredListWidget that allows the user to select certain values of a property for the criterion.
-
accept
()¶ Actions when the user presses the accept button. Calls parent.setSelectedValues(values, value_edit) where values is a list of selected values and value_edit is passed to the __init__ method
-
reject
()¶ Actions when the user presses the cancel button. Calls propmenu.setCurrentIndex(0) on the propmenu passed to the __init__ function.
-