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.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

__init__(dataname, username, criteria, joiner='')

Create a StringDatabaseCriterion object

Parameters
  • dataname (str) – The internal name of the property this criterion checks. The dataname is of the form x_y_z.

  • username (str) – The name the user sees for this property

  • criteria (list of tuple) – List of one or two criterion. Each criterion is a tuple consisting of (operator, value). operator is some relationship defined by the constants in this module, and value is the target value. For instance, in property > 5, ‘>’ is the operator and 5 is the value.

Operator constants are:

  • EQUALS

  • NOT_EQUALS

  • CONTAINS

  • STARTSWITH

  • ENDSWITH

  • NOT_CONTAINS

  • EXISTS

  • NOT_EXISTS

  • SELECT

  • GREATEREQUAL

  • LESSEREQUAL

  • GREATER

  • LESSER

  • IS_TRUE

  • IS_FALSE

For the SELECT operator, value can be a list of values. A property that matches any one of those values exactly matches the criterion.

Parameters

joiner (str) – If two criteria are provided, joiner is the boolean that connects them - either AND or OR. Default is the empty string, which means that only the first criterion in the criteria list will be examined.

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
  • obj_val (str) – The value being checked

  • operator (str) – An operator as defined in the __init__ method criteria paramater.

  • goal (str or list) – The value to compare against, or in the case of the SELECT operator, goal is a list of str

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 a schrodinger.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.

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 the StringDatabaseCriterion 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.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 the StringDatabaseCriterion 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: PyQt6.QtCore.QAbstractListModel

Class for storing the criteria list information.

__init__()
rowCount(parent=<PyQt6.QtCore.QModelIndex object>)

Returns number of rows

clear()
addLine(line, linetype=None)
data(index, role=ItemDataRole.DisplayRole)

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.

class schrodinger.application.bioluminate.propfilter.SelectingFilteredListWidget(label=None, filterlabel='Filter:', filter='within', filterside='bottom', case=False, layout=None, **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.

filterList(filtervalue)

Modified from the parent class to select all the objects in the ListWidget that match the filter.

Parameters

filtervalue (str) – The value used to filter the ListWidget

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.

__init__(master, *args, **kwargs)

Create a PropertySelectorWithRanges instance.

Parameters

master (object with getPropertyMinMax method) – The master panel that supplies the min and max values of numerical properties for the range display

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.ValueSelectionDialog(parent, values, propmenu, value_edit)

Bases: PyQt6.QtWidgets.QDialog

A SFilteredListWidget that allows the user to select certain values of a property for the criterion.

__init__(parent, values, propmenu, value_edit)

Create a ValueSelectionDialog instance

Parameters
  • parent (QWidget with setSelectedValues method) – The parent widget of this dialog. The accept method of this dialog calls the setSelectedValues method of the parent with the list of selected text in the QListWidget

  • values (list) – List of values to display in the QListWidget

  • propmenu (QComboBox or object with setCurrentIndex method) – The cancel method of this dialog sets propmenu.setCurrentIndex(0)

  • value_edit – value_edit is passed to parent.setSelectedValues in the accept method of the dialog

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.

class schrodinger.application.bioluminate.propfilter.PropFilterDialog(parent, criteria=None, databases=None)

Bases: PyQt6.QtWidgets.QDialog

Panel to allow the user to define criteria for filtering property values

__init__(parent, criteria=None, databases=None)

Create a PropFilterDialog instance

Parameters
getCumulativeMatches()
accept()

Add the selected criteria to the parent - calls parent.setCriteria() with a list of StringDatabaseCriterion, NumericalDatabaseCriterion and BooleanDatabaseCriterion objects

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

selectProperty()

Populate the property name edit with the property name of the property the user just selected.

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

updateText()

Rewrite the text in the criteria text box

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

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

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

addCriterion()

Adds a criterion when the user hits the Add button

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

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

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

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

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

deleteEntry()

Delete the selected criterion or pattern

setDefaults(criteria=None)

Set the panel defaults

Parameters

criteria (list) – Pre-existing StringDatabaseCriterion, NumericalDatabaseCriterion and BooleanDatabaseCriterion 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 a schrodinger.structure.PropertyName object for a property that the user can select from

warning(text)

Pop up a warning dialog

Parameters

text (str) – The text to display in the dialog

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.