Welcome to harvdev-utils’s documentation!

Please refer to the sections below for information regarding common Python functions used by FlyBase developers at Harvard.

Modules for converting special characters

harvdev_utils init file.

harvdev_utils.sgml_to_plain_text(input_string)[source]

Convert FlyBase SGML to plain text Greek words.

e.g. “&agr; -> alpha”

Parameters:arg1 (str) – The “input_string” containing characters to be converted.
Returns:The same string as the input with the SGML characters converted.
Return type:str
Raises:KeyError – If the regex matches for a set of SGML characters but there is no exact matching SGML.
harvdev_utils.sgml_to_unicode(input_string)[source]

Convert FlyBase SGML to Greek characters in unicode.

e.g. “&agr;” -> “\u03B1”

Parameters:arg1 (str) – The “input_string” containing FB SGML characters to be converted.
Returns:The same string as the input with the SGML characters converted to unicode.
Return type:str
Raises:KeyError – If the regex matches for a set of SGML characters but there is no exact matching SGML.
harvdev_utils.unicode_to_plain_text(input_string)[source]

Convert Greek unicode to plain text Greek words.

e.g. “\u03B1” -> “alpha”

Parameters:arg1 (str) – The “input_string” containing Greek unicode characters to be converted.
Returns:The same string as the input with the Greek unicode characters transliterated.
Return type:str
Raises:KeyError – If the regex matches for a set of unicode characters but there is no exact matching plain text.
harvdev_utils.sub_sup_to_sgml(input_string)[source]

Convert bracket characters to up and down flags.

e.g. “[hello]” -> “<up>hello</up>”

Parameters:arg1 (str) – The “input_string” containing bracket characters to be converted.
Returns:The same string as the input with the bracket characters converted to up and down flags.
Return type:str
harvdev_utils.get_or_create(session: sqlalchemy.orm.session.Session, model, **kwargs)[source]
Parameters:
  • session – The current session in use by SQL Alchemy
  • model – The table to be queried.
  • kwargs – Values for the table used for lookup (e.g. name=’awesome gene’)
Returns:

Both an SQL Alchemy object and True (if new object created) or False (if object retrieved)

harvdev_utils.get_cvterm(session: sqlalchemy.orm.session.Session, cv_name: str, cvterm_name: str) → harvdev_utils.production.production.Cvterm[source]

Lookup cvterm.

Indices and tables