Constants

PyBEL Constants

This module maintains the strings used throughout the PyBEL codebase to promote consistency.

Configuration Loading

By default, PyBEL loads its configuration from ~/.config/pybel/config.json. This json is stored in the object pybel.constants.config.

pybel.constants.GOCC_LATEST = 'https://arty.scai.fraunhofer.de/artifactory/bel/namespace/go-cellular-component/go-cellular-component-20170511.belns'

GOCC is the only namespace that needs to be stored because translocations use some of its values by default

pybel.constants.PYBEL_CONNECTION = 'PYBEL_CONNECTION'

The environment variable that contains the default SQL connection information for the PyBEL cache

pybel.constants.PYBEL_DIR = '/home/docs/.pybel'

The default directory where PyBEL files, including logs and the default cache, are stored. Created if not exists.

pybel.constants.PYBEL_LOG_DIR = '/home/docs/.pybel/logs'

The default directory where PyBEL logs are stored

pybel.constants.PYBEL_DATA_DIR = '/home/docs/.pybel/data'

The default directory where PyBEL data are stored

pybel.constants.DEFAULT_CACHE_LOCATION = '/home/docs/.pybel/data/pybel_cache.db'

The default cache location is ~/.pybel/data/pybel_cache.db

pybel.constants.DEFAULT_CACHE_CONNECTION = 'sqlite:////home/docs/.pybel/data/pybel_cache.db'

The default cache connection string uses sqlite.

pybel.constants.config = {'PYBEL_CONNECTION': 'sqlite:////home/docs/.pybel/data/pybel_cache.db'}

The global configuration for PyBEL is stored here. By default, it loads from ~/.config/pybel/config.json

pybel.constants.get_cache_connection()[source]

Returns the default cache connection string

pybel.constants.BEL_DEFAULT_NAMESPACE = 'bel'

The default namespace given to entities in the BEL language

pybel.constants.CITATION_TYPES = {'DOI', 'PubMed', 'Journal', 'URL', 'Other', 'Online Resource', 'Book'}

The valid citation types .. seealso:: https://wiki.openbel.org/display/BELNA/Citation

pybel.constants.NAMESPACE_DOMAIN_TYPES = {'Gene and Gene Products', 'Chemical', 'Other', 'BiologicalProcess'}

The valid namespace types .. seealso:: https://wiki.openbel.org/display/BELNA/Custom+Namespaces

pybel.constants.CITATION_TYPE = 'type'

Represents the key for the citation type in a citation dictionary

pybel.constants.CITATION_NAME = 'name'

Represents the key for the citation name in a citation dictionary

pybel.constants.CITATION_REFERENCE = 'reference'

Represents the key for the citation reference in a citation dictionary

pybel.constants.CITATION_DATE = 'date'

Represents the key for the citation date in a citation dictionary

pybel.constants.CITATION_AUTHORS = 'authors'

Represents the key for the citation authors in a citation dictionary

pybel.constants.CITATION_COMMENTS = 'comments'

Represents the key for the citation comment in a citation dictionary

pybel.constants.CITATION_ENTRIES = ('type', 'name', 'reference', 'date', 'authors', 'comments')

Represents the ordering of the citation entries in a control statement (SET Citation = ...)

pybel.constants.FUNCTION = 'function'

The node data key specifying the node’s function (e.g. GENE, MIRNA, BIOPROCESS, etc.)

pybel.constants.NAMESPACE = 'namespace'

The key specifying an identifier dictionary’s namespace. Used for nodes, activities, and transformations.

pybel.constants.NAME = 'name'

The key specifying an identifier dictionary’s name. Used for nodes, activities, and transformations.

pybel.constants.IDENTIFIER = 'identifier'

The key specifying an identifier dictionary

pybel.constants.LABEL = 'label'

The key specifying an optional label for the node

pybel.constants.DESCRIPTION = 'description'

The key specifying an optional description for the node

pybel.constants.FUSION = 'fusion'

The node data key specifying a fusion dictionary, containing PARTNER_3P, PARTNER_5P,

pybel.constants.PARTNER_3P = 'partner_3p'

The key specifying the identifier dictionary of the fusion’s 3-Prime partner

pybel.constants.PARTNER_5P = 'partner_5p'

The key specifying the identifier dictionary of the fusion’s 5-Prime partner

pybel.constants.RANGE_3P = 'range_3p'

The key specifying the range dictionary of the fusion’s 3-Prime partner

pybel.constants.RANGE_5P = 'range_5p'

The key specifying the range dictionary of the fusion’s 5-Prime partner

pybel.constants.KIND = 'kind'

The key representing what kind of variation is being represented

pybel.constants.HGVS = 'hgvs'

The value for KIND for an HGVS variant

pybel.constants.PMOD = 'pmod'

The value for KIND for a protein modification

pybel.constants.GMOD = 'gmod'

The value for KIND for a gene modification

pybel.constants.FRAGMENT = 'frag'

The value for KIND for a fragment

pybel.constants.DIRTY = 'dirty'

Used as a namespace when none is given when lenient parsing mode is turned on. Not recommended!

pybel.constants.GENE = 'Gene'

Represents the BEL abundance, geneAbundance() .. seealso:: http://openbel.org/language/version_2.0/bel_specification_version_2.0.html#Xabundancea

pybel.constants.RNA = 'RNA'

Represents the BEL abundance, rnaAbundance()

pybel.constants.PROTEIN = 'Protein'

Represents the BEL abundance, proteinAbundance()

pybel.constants.MIRNA = 'miRNA'

Represents the BEL abundance, microRNAAbundance()

pybel.constants.ABUNDANCE = 'Abundance'

Represents the BEL abundance, abundance()

pybel.constants.BIOPROCESS = 'BiologicalProcess'

Represents the BEL function, biologicalProcess()

pybel.constants.PATHOLOGY = 'Pathology'

Represents the BEL function, pathology()

pybel.constants.COMPOSITE = 'Composite'

Represents the BEL abundance, compositeAbundance()

pybel.constants.COMPLEX = 'Complex'

Represents the BEL abundance, complexAbundance()

pybel.constants.REACTION = 'Reaction'

Represents the BEL transformation, reaction()

pybel.constants.RELATION = 'relation'

The key for an internal edge data dictionary for the relation string

pybel.constants.CITATION = 'citation'

The key for an internal edge data dictionary for the citation dictionary

pybel.constants.EVIDENCE = 'evidence'

The key for an internal edge data dictionary for the evidence string

pybel.constants.ANNOTATIONS = 'annotations'

The key for an internal edge data dictionary for the annotations dictionary

pybel.constants.SUBJECT = 'subject'

The key for an internal edge data dictionary for the subject modifier dictionary

pybel.constants.OBJECT = 'object'

The key for an internal edge data dictionary for the object modifier dictionary

pybel.constants.LINE = 'line'

The key or an internal edge data dictionary for the line number

pybel.constants.ID = 'id'

The key representing the hash of the other

pybel.constants.PYBEL_EDGE_DATA_KEYS = {'subject', 'annotations', 'object', 'citation', 'relation', 'evidence'}

The group of all BEL-provided keys for edge data dictionaries

pybel.constants.PYBEL_EDGE_ALL_KEYS = {'subject', 'annotations', 'object', 'citation', 'line', 'relation', 'evidence', 'id'}

The group of all PyBEL annotated keys for edge data dictionaries

pybel.constants.HAS_REACTANT = 'hasReactant'

A BEL relationship

pybel.constants.HAS_PRODUCT = 'hasProduct'

A BEL relationship

pybel.constants.HAS_COMPONENT = 'hasComponent'

A BEL relationship

pybel.constants.HAS_VARIANT = 'hasVariant'

A BEL relationship

pybel.constants.HAS_MEMBER = 'hasMember'

A BEL relationship

pybel.constants.TRANSCRIBED_TO = 'transcribedTo'

A BEL relationship GENE to RNA is called transcription

pybel.constants.TRANSLATED_TO = 'translatedTo'

A BEL relationship RNA to PROTEIN is called translation

pybel.constants.INCREASES = 'increases'

A BEL relationship

pybel.constants.DIRECTLY_INCREASES = 'directlyIncreases'

A BEL relationship

pybel.constants.DECREASES = 'decreases'

A BEL relationship

pybel.constants.DIRECTLY_DECREASES = 'directlyDecreases'

A BEL relationship

pybel.constants.CAUSES_NO_CHANGE = 'causesNoChange'

A BEL relationship

pybel.constants.REGULATES = 'regulates'

A BEL relationship

pybel.constants.NEGATIVE_CORRELATION = 'negativeCorrelation'

A BEL relationship

pybel.constants.POSITIVE_CORRELATION = 'positiveCorrelation'

A BEL relationship

pybel.constants.ASSOCIATION = 'association'

A BEL relationship

pybel.constants.ORTHOLOGOUS = 'orthologous'

A BEL relationship

pybel.constants.ANALOGOUS_TO = 'analogousTo'

A BEL relationship

pybel.constants.IS_A = 'isA'

A BEL relationship

pybel.constants.RATE_LIMITING_STEP_OF = 'rateLimitingStepOf'

A BEL relationship

pybel.constants.SUBPROCESS_OF = 'subProcessOf'

A BEL relationship

pybel.constants.BIOMARKER_FOR = 'biomarkerFor'

A BEL relationship

pybel.constants.PROGONSTIC_BIOMARKER_FOR = 'prognosticBiomarkerFor'

A BEL relationship

pybel.constants.EQUIVALENT_TO = 'equivalentTo'

A BEL relationship, added by PyBEL

pybel.constants.CAUSAL_INCREASE_RELATIONS = {'directlyIncreases', 'increases'}

A set of all causal relationships that have an increasing effect

pybel.constants.CAUSAL_DECREASE_RELATIONS = {'directlyDecreases', 'decreases'}

A set of all causal relationships that have a decreasing effect

pybel.constants.CAUSAL_RELATIONS = {'directlyIncreases', 'directlyDecreases', 'decreases', 'increases'}

A set of all causal relationships

pybel.constants.TWO_WAY_RELATIONS = {'negativeCorrelation', 'association', 'positiveCorrelation', 'analogousTo', 'equivalentTo', 'orthologous'}

A set of all relationships that are inherently directionless, and are therefore added to the graph twice

pybel.constants.CORRELATIVE_RELATIONS = {'negativeCorrelation', 'positiveCorrelation'}

A set of all correlative relationships

pybel.constants.unqualified_edges = ['hasReactant', 'hasProduct', 'hasComponent', 'hasVariant', 'transcribedTo', 'translatedTo', 'hasMember', 'isA']

A list of relationship types that don’t require annotations or evidence This must be maintained as a list, since the unqualified_edge_code is calculated based on the order and needs to be consistent

pybel.constants.unqualified_edge_code = {'hasMember': -7, 'hasComponent': -3, 'transcribedTo': -5, 'isA': -8, 'hasReactant': -1, 'hasProduct': -2, 'hasVariant': -4, 'translatedTo': -6}

Unqualified edges are given negative keys since the standard NetworkX edge key factory starts at 0 and counts up

pybel.constants.GRAPH_METADATA = 'document_metadata'

The key for the document metadata dictionary. Can be accessed by graph.graph[GRAPH_METADATA], or by using the property built in to the pybel.BELGraph, pybel.BELGraph.document()

pybel.constants.METADATA_NAME = 'name'

The key for the document name. Can be accessed by graph.document[METADATA_NAME] or by using the property built into the pybel.BELGraph class, pybel.BELGraph.name()

pybel.constants.METADATA_VERSION = 'version'

The key for the document version. Can be accessed by graph.document[METADATA_VERSION]

pybel.constants.METADATA_DESCRIPTION = 'description'

The key for the document description. Can be accessed by graph.document[METADATA_DESCRIPTION]

pybel.constants.METADATA_AUTHORS = 'authors'

The key for the document authors. Can be accessed by graph.document[METADATA_NAME]

pybel.constants.METADATA_CONTACT = 'contact'

The key for the document contact email. Can be accessed by graph.document[METADATA_CONTACT]

pybel.constants.METADATA_LICENSES = 'licenses'

The key for the document licenses. Can be accessed by graph.document[METADATA_LICENSES]

The key for the document copyright information. Can be accessed by graph.document[METADATA_COPYRIGHT]

pybel.constants.METADATA_DISCLAIMER = 'disclaimer'

The key for the document disclaimer. Can be accessed by graph.document[METADATA_DISCLAIMER]

pybel.constants.METADATA_PROJECT = 'project'

The key for the document project. Can be accessed by graph.document[METADATA_PROJECT]

pybel.constants.DOCUMENT_KEYS = {'Authors': 'authors', 'Copyright': 'copyright', 'Name': 'name', 'Disclaimer': 'disclaimer', 'Licenses': 'licenses', 'ContactInfo': 'contact', 'Description': 'description', 'Project': 'project', 'Version': 'version'}

Provides a mapping from BEL language keywords to internal PyBEL strings

pybel.constants.METADATA_INSERT_KEYS = {'copyright', 'disclaimer', 'name', 'contact', 'authors', 'licenses', 'version', 'description'}

The keys to use when inserting a graph to the cache

pybel.constants.INVERSE_DOCUMENT_KEYS = {'version': 'Version', 'copyright': 'Copyright', 'disclaimer': 'Disclaimer', 'name': 'Name', 'licenses': 'Licenses', 'authors': 'Authors', 'description': 'Description', 'contact': 'ContactInfo', 'project': 'Project'}

Provides a mapping from internal PyBEL strings to BEL language keywords. Is the inverse of DOCUMENT_KEYS

pybel.constants.REQUIRED_METADATA = {'version', 'name', 'description', 'contact', 'authors'}

A set representing the required metadata during BEL document parsing

pybel.constants.FRAGMENT_START = 'start'

The key for the starting position of a fragment range

pybel.constants.FRAGMENT_STOP = 'stop'

The key for the stopping position of a fragment range

pybel.constants.FRAGMENT_MISSING = 'missing'

The key signifying that there is neither a start nor stop position defined

pybel.constants.FRAGMENT_DESCRIPTION = 'description'

The key for any additional descriptive data about a fragment

pybel.constants.GMOD_ORDER = ['kind', 'identifier']

The order for serializing gene modification data

pybel.constants.GSUB_REFERENCE = 'reference'

The key for the reference nucleotide in a gene substitution. Only used during parsing since this is converted to HGVS.

pybel.constants.GSUB_POSITION = 'position'

The key for the position of a gene substitution. Only used during parsing since this is converted to HGVS

pybel.constants.GSUB_VARIANT = 'variant'

The key for the effect of a gene substitution. Only used during parsing since this is converted to HGVS

pybel.constants.PMOD_CODE = 'code'

The key for the protein modification code.

pybel.constants.PMOD_POSITION = 'pos'

The key for the protein modification position.

pybel.constants.PMOD_ORDER = ['kind', 'identifier', 'code', 'pos']

The order for serializing information about a protein modification

pybel.constants.PSUB_REFERENCE = 'reference'

The key for the reference amino acid in a protein substitution. Only used during parsing since this is concerted to HGVS

pybel.constants.PSUB_POSITION = 'position'

The key for the position of a protein substitution. Only used during parsing since this is converted to HGVS.

pybel.constants.PSUB_VARIANT = 'variant'

The key for the variant of a protein substitution.Only used during parsing since this is converted to HGVS.

pybel.constants.TRUNCATION_POSITION = 'position'

The key for the position at which a protein is truncated

pybel.constants.belns_encodings = {'A': {'Gene', 'Complex', 'Abundance', 'miRNA', 'Protein', 'RNA'}, 'B': {'Pathology', 'BiologicalProcess'}, 'C': {'Complex'}, 'O': {'Pathology'}, 'R': {'miRNA', 'RNA'}, 'P': {'Protein'}, 'G': {'Gene'}, 'M': {'miRNA'}}

The mapping from BEL namespace codes to PyBEL internal abundance constants ..seealso:: https://wiki.openbel.org/display/BELNA/Assignment+of+Encoding+%28Allowed+Functions%29+for+BEL+Namespaces

BEL Language

This module contains mappings between PyBEL’s internal constants and BEL language keywords

pybel.parser.language.abundance_labels = {'composite': 'Composite', 'p': 'Protein', 'r': 'RNA', 'microRNAAbundance': 'miRNA', 'a': 'Abundance', 'proteinAbundance': 'Protein', 'pathology': 'Pathology', 'rnaAbundance': 'RNA', 'bp': 'BiologicalProcess', 'abundance': 'Abundance', 'compositeAbundance': 'Composite', 'g': 'Gene', 'path': 'Pathology', 'geneAbundance': 'Gene', 'biologicalProcess': 'BiologicalProcess', 'm': 'miRNA', 'complexAbundance': 'Complex', 'complex': 'Complex'}

Provides a mapping from BEL terms to PyBEL internal constants

pybel.parser.language.aa_placeholder = "X"

In biological literature, the X is used to denote a truncation. Text mining efforts often encode X as an amino acid, for which we will throw an error using handle_aa_placeholder()

pybel.parser.language.handle_aa_placeholder(line, position, tokens)[source]

Raises an exception when encountering a placeholder amino acid, X

pybel.parser.language.pmod_namespace = {'farnesylation': 'Farn', 'adenosine diphosphoribosyl': 'ADPRib', 'acetylation': 'Ac', 'ADP-ribosylation': 'ADPRib', 'sulphation': 'Sulf', 'dimethylation': 'Me2', 'Lysine 48-linked polyubiquitination': 'UbK48', 'ubiquitylation': 'Ub', 'Sumo': 'Sumo', 'trimethylation': 'Me3', 'SUMOylation': 'Sumo', 'Gerger': 'Gerger', 'ISG': 'ISG', 'Hy': 'Hy', 'sulfur addition': 'Sulf', 'Me': 'Me', 'O-linked glycosylation': 'OGlyco', 'oxidation': 'Ox', 'Palm': 'Palm', 'Me3': 'Me3', 'UbK48': 'UbK48', 'polyubiquitination': 'UbPoly', 'Lysine 63-linked polyubiquitination': 'UbK63', 'Ph': 'Ph', 'Myr': 'Myr', 'N-linked glycosylation': 'NGlyco', 'NGlyco': 'NGlyco', 'ubiquitination': 'Ub', 'sulfation': 'Sulf', 'Nitrosylation': 'NO', 'hydroxylation': 'Hy', 'geranylgeranylation': 'Gerger', 'glycosylation': 'Glyco', 'ISGylation': 'ISG', 'Me2': 'Me2', 'sulphonation': 'sulfonation', 'Sulf': 'Sulf', 'tri-methylation': 'Me3', 'di-methylation': 'Me2', 'NO': 'NO', 'Farn': 'Farn', 'methylation': 'Me', 'sulphur addition': 'Sulf', 'UbMono': 'UbMono', 'Me1': 'Me1', 'ADPRib': 'ADPRib', 'Glyco': 'Glyco', 'Ub': 'Ub', 'monomethylation': 'Me1', 'UbK63': 'UbK63', 'Ac': 'Ac', 'Ox': 'Ox', 'ISG15-protein conjugation': 'ISG', 'UbPoly': 'UbPoly', 'palmitoylation': 'Palm', 'sulfonation': 'sulfonation', 'myristoylation': 'Myr', 'mono-methylation': 'Me1', 'OGlyco': 'OGlyco', 'ubiquitinylation': 'Ub', 'neddylation': 'Nedd', 'phosphorylation': 'Ph', 'monoubiquitination': 'UbMono', 'Nedd': 'Nedd'}

A dictionary of default protein modifications to their preferred value

pybel.parser.language.pmod_legacy_labels = {'A': 'Ac', 'U': 'Ub', 'R': 'ADPRib', 'F': 'Farn', 'P': 'Ph', 'G': 'Glyco', 'O': 'Ox', 'M': 'Me', 'S': 'Sumo', 'H': 'Hy'}

A dictionary of legacy (BEL 1.0) default namespace protein modifications to their BEL 2.0 preferred value

pybel.parser.language.gmod_namespace = {'Me': 'Me', 'methylation': 'Me', 'M': 'Me'}

A dictionary of default gene modifications. This is a PyBEL variant to the BEL specification.