Support functions for Structure property manipulation functions in the
propeditor script.
Structures can be created by reading files in any supported
format.
Copyright Schrodinger, LLC. All rights reserved
|
fxnname()
Return a function's name |
|
|
|
checkCompatibleTypes(prop1,
prop2)
Check that the prop1 can be converted into a prop of type prop2 |
|
|
|
get_op_positions(formula,
allowed_operators=allowed_operators)
Get a list of tuples of start and end positions for all operators. |
|
|
|
checkCT(ct,
ranges)
Checks individual structure (ct) for compliance with user input range
parameters. |
|
|
|
merge_op_positions(op_positions)
Merge individual operator positions into a list of all positions of
the formula string and whether they contain an operator The result is
a list of Boolean values for each character in the formula string
indicating if that character is a known operator. |
|
|
|
generate_groups(formula)
Build 'groups' of the formula pieces, marking each as an operator or
not |
|
|
|
check_formula(formula,
existing_properties=[])
Does some basic checking of the formula |
|
|
|
generate_eval_string(groups,
group_types,
ct_str='ct')
Generate a string to use in eval for calculation from the groups |
|
|
|
generate_eval_string_all(formula_part,
ct_str='ct')
Generate a string to use in eval for calculation from the formula |
|
|
|
calcProperty(ct,
formula,
tocheck_formula=True)
Calculate and set a new property based on calculation from a function
of existing properties. |
|
|
|
listProps(prop_dict)
Print the values for a set of properties. |
|
|
|
listElements(structure)
Sorts the elements in a list and displays them with a count as the
first line |
|
|
|
sliceProp(ct,
propn,
newn,
startval,
endval)
Takes a property, slices its value according to input endpoints and
creates a new property with the sliced portion as the value. |
|
|
|
merge(ct,
prop1,
prop2,
delim,
newname)
Merges the value of two properties according a specified delimiter
and creates a new property with the merged value and the name
'newname'. |
|
|
|
addProperty(ct,
prop,
val,
add,
num=-1)
Adds a property to the input structure with the given value. |
|
|
|
copyProperty(ct,
prop1,
prop2)
Copies the value of one property to another property. |
|
|
|
|
|
delete(ct,
prop)
Deletes a property from a structure |
|
|
|
clear(ct,
prop)
Clears the value of a property For integer and float property types
sets property value to zero. |
|
|
|
split(ct,
propn,
prop1,
prop2,
delim)
Splits the value of a property according to a given delimiter. |
|
|
|
conv_bool(value,
allow_onezero=True)
Convert a boolean string to True/False. |
|
|
|
get_type(value,
onezero_boolean=True)
Get the type of a string value |
|
|
|
readData(filename,
ct_key_prop,
csv_key_prop,
tab_delim=False,
data={},
prop_group='user',
onezero_boolean=True,
use_first_value=False,
missing_key='MISSINGENTRY')
Read the data of a .csv file into a dict using the csv package. |
|
|
|
exportFile(ct,
fileobj,
num,
props=[],
tab_delim=False)
Exports a .mae file into a .csv file |
|
|
|
printvals(props,
input_fn,
rules)
Given a list of properties and an input file prints out the values of
every property for every ct in the input file If a set of rules has
been entered, first checks if the CT abides by the rules and only
prints out property values if it does. |
|
|
|
_version = '$Revision: 1.9 $'
|
|
ranges = []
|
|
compatible_types = {'b': ['b', 'i', 'r', 's'], 'i': ['i', 'r',...
|
|
stepdown_conv = {'b': ['',], 'i': ['', 'b'], 'r': ['', 'b', 'i...
|
|
missing_values = {'b': False, 'i': 0, 'r': 0.0, 's': ''}
|
|
number_regexs = ["^[+-.]$", "[+-]?[0-9]+[.]?[0-9]*[eE][+-]?[0-...
|
|
number_REs = [re.compile(x) for x in number_regexs]
|
|
prop_RE = re.compile('[ribs]_.*?_')
|
|
numeric_prop_RE = re.compile('[ri]_.*?_')
|
|
space_RE = re.compile('\s')
|
|
allowed_operators = ['**', '=', '+', '-', '*', '/', '(', ')']
|
|
op_REs = []
|
|
allowed_functions = [math.acos, math.asin, math.atan, math.cos...
|
|
allowed_function_names = [x.__name__ for x in allowed_functions]
|
|
allowed_function_modules = {}
|
|
conv_functions = {'b': conv_bool, 'i': int, 'r': float, 's': str}
|
|
conv_keys = ['b', 'i', 'r', 's']
|