Numerical Functions (violin.numeric)
This page details the numeric operators of VIOLIN.
These functions discretize qualitative operations within VIOLIN:
searching for an element in the reading output,
comparing attributes, indentifying whether a given attribute
matches exactly an attribute in a corresponding model interaction (MI),
is missing where a MI attribute is present,
is present where a MI attribute is missing,
differs from an attribute in a corresponding MI.
Both functions return numerical values to represent the outcome of the function.
Functions
- violin.numeric.get_attributes(A_idx: int, B_idx: int, sign: str, model_df: pandas.core.frame.DataFrame, attrs: list, path: bool = False) dict[source]
The function gets the attributes of the interaction in model, available attributes includes [Regulator Compartment, Regulator Compartment ID, Regulated Compartment, Regulated Compartment ID, Mechansim, Site, Cell Line, Cell Type, Tissue Type, Organism]. If Regulator Compartment is selected, Regulator Compartment ID will also be selected.
- Parameters
A_idx (int) – A row index of element A in the input model dataframe.
B_idx (int) – A row index of element B in the input model dataframe.
sign (str) – A sign of the interaction, available options: ‘positive’ or ‘negative’.
model_df (pd.DataFrame) – A DataFrame of a model with BioRECIPE format.
attrs (list) – An attributes list for interactions file.
path (bool) – An indicator if it is path interaction. Attributes will be empty if only path is found in model.
- Returns
model_atts – An dict of attributes for a model interaction.
- Return type
dict
- violin.numeric.find_element(search_type: str, element_name: str, element_type: str, model_df: pandas.core.frame.DataFrame, id_db: Optional[str] = None) Union[List, int][source]
This function finds the correct indices of an element within the model. Because elements can exist as multiple types (protein, RNA, gene, etc.), this function checks the element name/ID along with the element type. Function may return a list, if a given element of a specific type exists with varying attributes (such as different locations).
- Parameters
search_type (str) – An identifier of the element, available options are ‘hgnc’, ‘name’, and ‘id’.
element_name (str) – A name (or ID) of the element being searched for.
element_type (str) – A type of element (‘protein’, ‘protein family’, etc.)
model_df (pd.DataFrame) – A model dataframe within BioRECIPE format.
id_db (str) – A database name for provided identifier.
- Returns
location – All row indices of the model spreadsheet in which the element is found (returns -1 if not found).
- Return type
list|int
- violin.numeric.compare(model_atts: dict, reading_atts: dict) int[source]
- Compares a list of model attributes to the corresponding interaction attributes, returns numeric value
Attributes are the same (strong corroboration): 0
Some or all LEE attributes are missing (weak corroboration): 1
Some or all of the model attributes are missing (specification): 2
One or more model attribute differs from the LEE attributes (contradiction): 3
- Parameters
model_atts (dict) – A dictionary of attributes for a model interaction.
reading_atts (dict) – A dictionary of attributes for an event from a literactions list.
- Returns
value – The numerical representation of comparison outcome.
- Return type
int
Dependencies
Python: pandas library
VIOLIN: none
Usage
This example searches for the index of protein family AMPK in the model spreadsheet.:
find_element_index("name","ampk","protein family",model_df)
>> 2
This example compares the location of the reading interaction to the location of its counterpart interaction in the model.:
reading_att = "nan"
model_att = "GO:0005737"
compare(model_att,reading_att)
>> 2