Skip to content

ipr.util

VERBOSE_ERROR_CODE

VERBOSE_ERROR_CODE = (logging.INFO + logging.DEBUG) // 2

logger

logger = logging.getLogger('ipr')

LOG_LEVELS

LOG_LEVELS = {
    'info': logging.INFO,
    'debug': logging.DEBUG,
    'warn': logging.WARN,
    'error': logging.ERROR,
    'verbose': VERBOSE_ERROR_CODE,

create_variant_name()

Given an IPR variant row, create the variant representation to be used as the name of the variant

def create_variant_name(variant: IprVariant) -> str:

Args

Returns

  • str

create_variant_name_tuple()

Given an IPR variant row, create the variant representation to be used as the name of the variant

def create_variant_name_tuple(variant: IprVariant) -> Tuple[str, str]:

Args

Returns

  • Tuple[str, str]

find_variant()

Find a variant in a list of variants by its key and type

def find_variant(all_variants: List[IprVariant], variant_type: str, variant_key: str) -> IprVariant:

Args

  • all_variants (List[IprVariant])
  • variant_type (str)
  • variant_key (str)

Returns

generate_ontology_preference_key()

Generate a tuple key for comparing preferred ontology terms.

def generate_ontology_preference_key(record: Dict, sources_sort: Dict[str, int] = {}) -> Tuple:

Args

  • record (Dict)
  • sources_sort (Dict[str, int])

Returns

  • Tuple

get_preferred_drug_representation()

Given a Drug record, follow its linked records to find the preferred representation by following alias, deprecating, and cross reference links

def get_preferred_drug_representation(graphkb_conn: GraphKBConnection, drug_record_id: str) -> Dict:

Args

  • graphkb_conn (GraphKBConnection)
  • drug_record_id (str)

Returns

  • Dict

get_preferred_gene_name()

Given some Feature record ID return the preferred gene name

def get_preferred_gene_name(graphkb_conn: GraphKBConnection, record_id: str) -> str:

Args

  • graphkb_conn (GraphKBConnection)
  • record_id (str)

Returns

  • str

pandas_falsy()

Check if a field is python falsy or pandas null

def pandas_falsy(field):

Args

  • field
Back to top