Module: BELParser::Language

Defined in:
lib/bel_parser/language.rb,
lib/bel_parser/language/syntax.rb,
lib/bel_parser/language/function.rb,
lib/bel_parser/language/semantics.rb,
lib/bel_parser/language/signature.rb,
lib/bel_parser/language/amino_acid.rb,
lib/bel_parser/language/version1_0.rb,
lib/bel_parser/language/version2_0.rb,
lib/bel_parser/language/relationship.rb,
lib/bel_parser/language/syntax_error.rb,
lib/bel_parser/language/semantics_ast.rb,
lib/bel_parser/language/specification.rb,
lib/bel_parser/language/syntax_result.rb,
lib/bel_parser/language/syntax_warning.rb,
lib/bel_parser/language/semantics_match.rb,
lib/bel_parser/language/syntax_function.rb,
lib/bel_parser/language/semantics_result.rb,
lib/bel_parser/language/semantics_warning.rb,
lib/bel_parser/language/base_specification.rb,
lib/bel_parser/language/semantics_function.rb,
lib/bel_parser/language/term_transformation.rb,
lib/bel_parser/language/expression_validator.rb,
lib/bel_parser/language/semantics_ast_warnings.rb,
lib/bel_parser/language/semantics_type_warning.rb,
lib/bel_parser/language/apply_default_namespace.rb,
lib/bel_parser/language/syntax/invalid_function.rb,
lib/bel_parser/language/apply_namespace_encoding.rb,
lib/bel_parser/language/semantics/non_object_list.rb,
lib/bel_parser/language/version1_0/functions/list.rb,
lib/bel_parser/language/version2_0/functions/list.rb,
lib/bel_parser/language/syntax/undefined_namespace.rb,
lib/bel_parser/language/semantics/signature_mapping.rb,
lib/bel_parser/language/syntax/invalid_relationship.rb,
lib/bel_parser/language/version1_0/functions/fusion.rb,
lib/bel_parser/language/version1_0/return_types/any.rb,
lib/bel_parser/language/version2_0/functions/fusion.rb,
lib/bel_parser/language/version2_0/return_types/any.rb,
lib/bel_parser/language/version1_0/return_types/list.rb,
lib/bel_parser/language/version2_0/functions/variant.rb,
lib/bel_parser/language/version2_0/return_types/list.rb,
lib/bel_parser/language/covalent_protein_modification.rb,
lib/bel_parser/language/version1_0/functions/products.rb,
lib/bel_parser/language/version1_0/functions/reaction.rb,
lib/bel_parser/language/version1_0/relationships/is_a.rb,
lib/bel_parser/language/version2_0/functions/activity.rb,
lib/bel_parser/language/version2_0/functions/fragment.rb,
lib/bel_parser/language/version2_0/functions/location.rb,
lib/bel_parser/language/version2_0/functions/products.rb,
lib/bel_parser/language/version2_0/functions/reaction.rb,
lib/bel_parser/language/version2_0/relationships/is_a.rb,
lib/bel_parser/language/semantics/function_deprecation.rb,
lib/bel_parser/language/version1_0/functions/abundance.rb,
lib/bel_parser/language/version1_0/functions/pathology.rb,
lib/bel_parser/language/version1_0/functions/reactants.rb,
lib/bel_parser/language/version1_0/return_types/fusion.rb,
lib/bel_parser/language/version1_0/value_encodings/any.rb,
lib/bel_parser/language/version2_0/functions/abundance.rb,
lib/bel_parser/language/version2_0/functions/pathology.rb,
lib/bel_parser/language/version2_0/functions/reactants.rb,
lib/bel_parser/language/version2_0/return_types/fusion.rb,
lib/bel_parser/language/version2_0/value_encodings/any.rb,
lib/bel_parser/language/semantics/list_function_subject.rb,
lib/bel_parser/language/version1_0/functions/truncation.rb,
lib/bel_parser/language/version2_0/return_types/variant.rb,
lib/bel_parser/language/syntax/undefined_namespace_value.rb,
lib/bel_parser/language/version1_0/functions/degradation.rb,
lib/bel_parser/language/version1_0/relationships/acts_in.rb,
lib/bel_parser/language/version1_0/return_types/products.rb,
lib/bel_parser/language/version2_0/functions/degradation.rb,
lib/bel_parser/language/version2_0/functions/to_location.rb,
lib/bel_parser/language/version2_0/relationships/acts_in.rb,
lib/bel_parser/language/version2_0/return_types/activity.rb,
lib/bel_parser/language/version2_0/return_types/fragment.rb,
lib/bel_parser/language/version2_0/return_types/location.rb,
lib/bel_parser/language/version2_0/return_types/products.rb,
lib/bel_parser/language/semantics/deeply_nested_statement.rb,
lib/bel_parser/language/semantics/multiple_subject_object.rb,
lib/bel_parser/language/version1_0/functions/substitution.rb,
lib/bel_parser/language/version1_0/relationships/includes.rb,
lib/bel_parser/language/version1_0/return_types/abundance.rb,
lib/bel_parser/language/version1_0/return_types/pathology.rb,
lib/bel_parser/language/version1_0/return_types/reactants.rb,
lib/bel_parser/language/version2_0/relationships/includes.rb,
lib/bel_parser/language/version2_0/return_types/abundance.rb,
lib/bel_parser/language/version2_0/return_types/pathology.rb,
lib/bel_parser/language/version2_0/return_types/reactants.rb,
lib/bel_parser/language/semantics/relationship_deprecation.rb,
lib/bel_parser/language/version1_0/functions/rna_abundance.rb,
lib/bel_parser/language/version1_0/functions/translocation.rb,
lib/bel_parser/language/version1_0/relationships/analogous.rb,
lib/bel_parser/language/version1_0/relationships/decreases.rb,
lib/bel_parser/language/version1_0/relationships/increases.rb,
lib/bel_parser/language/version1_0/return_types/truncation.rb,
lib/bel_parser/language/version2_0/functions/from_location.rb,
lib/bel_parser/language/version2_0/functions/rna_abundance.rb,
lib/bel_parser/language/version2_0/functions/translocation.rb,
lib/bel_parser/language/version2_0/relationships/analogous.rb,
lib/bel_parser/language/version2_0/relationships/decreases.rb,
lib/bel_parser/language/version2_0/relationships/increases.rb,
lib/bel_parser/language/version2_0/relationships/regulates.rb,
lib/bel_parser/language/version2_0/upgrades/transformation.rb,
lib/bel_parser/language/semantics/relationship_not_listable.rb,
lib/bel_parser/language/version1_0/functions/cell_secretion.rb,
lib/bel_parser/language/version1_0/functions/gene_abundance.rb,
lib/bel_parser/language/version1_0/relationships/has_member.rb,
lib/bel_parser/language/version2_0/functions/cell_secretion.rb,
lib/bel_parser/language/version2_0/functions/gene_abundance.rb,
lib/bel_parser/language/version2_0/relationships/has_member.rb,
lib/bel_parser/language/version2_0/return_types/to_location.rb,
lib/bel_parser/language/version2_0/value_encodings/activity.rb,
lib/bel_parser/language/version2_0/value_encodings/location.rb,
lib/bel_parser/language/version1_0/functions/kinase_activity.rb,
lib/bel_parser/language/version1_0/relationships/association.rb,
lib/bel_parser/language/version1_0/relationships/has_members.rb,
lib/bel_parser/language/version1_0/relationships/has_product.rb,
lib/bel_parser/language/version1_0/relationships/has_variant.rb,
lib/bel_parser/language/version1_0/relationships/orthologous.rb,
lib/bel_parser/language/version1_0/relationships/reactant_in.rb,
lib/bel_parser/language/version1_0/return_types/substitution.rb,
lib/bel_parser/language/version1_0/value_encodings/abundance.rb,
lib/bel_parser/language/version1_0/value_encodings/pathology.rb,
lib/bel_parser/language/version2_0/relationships/association.rb,
lib/bel_parser/language/version2_0/relationships/has_members.rb,
lib/bel_parser/language/version2_0/relationships/has_product.rb,
lib/bel_parser/language/version2_0/relationships/has_variant.rb,
lib/bel_parser/language/version2_0/relationships/orthologous.rb,
lib/bel_parser/language/version2_0/relationships/reactant_in.rb,
lib/bel_parser/language/version2_0/value_encodings/abundance.rb,
lib/bel_parser/language/version2_0/value_encodings/pathology.rb,
lib/bel_parser/language/semantics/non_causal_nested_statement.rb,
lib/bel_parser/language/version1_0/relationships/translocates.rb,
lib/bel_parser/language/version1_0/return_types/rna_abundance.rb,
lib/bel_parser/language/version2_0/relationships/translocates.rb,
lib/bel_parser/language/version2_0/return_types/from_location.rb,
lib/bel_parser/language/version2_0/return_types/rna_abundance.rb,
lib/bel_parser/language/version1_0/functions/complex_abundance.rb,
lib/bel_parser/language/version1_0/functions/protein_abundance.rb,
lib/bel_parser/language/version1_0/relationships/biomarker_for.rb,
lib/bel_parser/language/version1_0/relationships/has_component.rb,
lib/bel_parser/language/version1_0/relationships/translated_to.rb,
lib/bel_parser/language/version1_0/return_types/gene_abundance.rb,
lib/bel_parser/language/version2_0/functions/complex_abundance.rb,
lib/bel_parser/language/version2_0/functions/protein_abundance.rb,
lib/bel_parser/language/version2_0/relationships/biomarker_for.rb,
lib/bel_parser/language/version2_0/relationships/has_component.rb,
lib/bel_parser/language/version2_0/relationships/translated_to.rb,
lib/bel_parser/language/version2_0/return_types/gene_abundance.rb,
lib/bel_parser/language/version1_0/functions/biological_process.rb,
lib/bel_parser/language/version1_0/functions/catalytic_activity.rb,
lib/bel_parser/language/version1_0/functions/chaperone_activity.rb,
lib/bel_parser/language/version1_0/functions/gtp_bound_activity.rb,
lib/bel_parser/language/version1_0/functions/molecular_activity.rb,
lib/bel_parser/language/version1_0/functions/peptidase_activity.rb,
lib/bel_parser/language/version1_0/functions/transport_activity.rb,
lib/bel_parser/language/version1_0/relationships/has_components.rb,
lib/bel_parser/language/version1_0/relationships/sub_process_of.rb,
lib/bel_parser/language/version1_0/relationships/transcribed_to.rb,
lib/bel_parser/language/version1_0/return_types/kinase_activity.rb,
lib/bel_parser/language/version2_0/functions/biological_process.rb,
lib/bel_parser/language/version2_0/functions/molecular_activity.rb,
lib/bel_parser/language/version2_0/relationships/has_components.rb,
lib/bel_parser/language/version2_0/relationships/sub_process_of.rb,
lib/bel_parser/language/version2_0/relationships/transcribed_to.rb,
lib/bel_parser/language/version1_0/functions/composite_abundance.rb,
lib/bel_parser/language/version1_0/functions/micro_rna_abundance.rb,
lib/bel_parser/language/version1_0/value_encodings/rna_abundance.rb,
lib/bel_parser/language/version2_0/functions/composite_abundance.rb,
lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb,
lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb,
lib/bel_parser/language/semantics/nested_statement_without_object.rb,
lib/bel_parser/language/version1_0/functions/phosphatase_activity.rb,
lib/bel_parser/language/version1_0/functions/protein_modification.rb,
lib/bel_parser/language/version1_0/relationships/causes_no_change.rb,
lib/bel_parser/language/version1_0/relationships/has_modification.rb,
lib/bel_parser/language/version1_0/return_types/complex_abundance.rb,
lib/bel_parser/language/version1_0/return_types/protein_abundance.rb,
lib/bel_parser/language/version1_0/upgrades/fusion_transformation.rb,
lib/bel_parser/language/version1_0/value_encodings/gene_abundance.rb,
lib/bel_parser/language/version2_0/functions/protein_modification.rb,
lib/bel_parser/language/version2_0/relationships/causes_no_change.rb,
lib/bel_parser/language/version2_0/relationships/has_modification.rb,
lib/bel_parser/language/version2_0/return_types/complex_abundance.rb,
lib/bel_parser/language/version2_0/return_types/protein_abundance.rb,
lib/bel_parser/language/version2_0/value_encodings/gene_abundance.rb,
lib/bel_parser/language/version1_0/functions/ribosylation_activity.rb,
lib/bel_parser/language/version1_0/return_types/biological_process.rb,
lib/bel_parser/language/version1_0/return_types/catalytic_activity.rb,
lib/bel_parser/language/version1_0/return_types/chaperone_activity.rb,
lib/bel_parser/language/version1_0/return_types/gtp_bound_activity.rb,
lib/bel_parser/language/version1_0/return_types/molecular_activity.rb,
lib/bel_parser/language/version1_0/return_types/peptidase_activity.rb,
lib/bel_parser/language/version1_0/return_types/transport_activity.rb,
lib/bel_parser/language/version2_0/return_types/biological_process.rb,
lib/bel_parser/language/version2_0/return_types/molecular_activity.rb,
lib/bel_parser/language/version1_0/relationships/directly_decreases.rb,
lib/bel_parser/language/version1_0/relationships/directly_increases.rb,
lib/bel_parser/language/version1_0/return_types/micro_rna_abundance.rb,
lib/bel_parser/language/version1_0/upgrades/activity_transformation.rb,
lib/bel_parser/language/version2_0/relationships/directly_decreases.rb,
lib/bel_parser/language/version2_0/relationships/directly_increases.rb,
lib/bel_parser/language/version2_0/return_types/micro_rna_abundance.rb,
lib/bel_parser/language/version1_0/functions/cell_surface_expression.rb,
lib/bel_parser/language/version1_0/return_types/phosphatase_activity.rb,
lib/bel_parser/language/version1_0/return_types/protein_modification.rb,
lib/bel_parser/language/version1_0/upgrades/variation_transformation.rb,
lib/bel_parser/language/version1_0/value_encodings/complex_abundance.rb,
lib/bel_parser/language/version1_0/value_encodings/protein_abundance.rb,
lib/bel_parser/language/version2_0/functions/cell_surface_expression.rb,
lib/bel_parser/language/version2_0/return_types/protein_modification.rb,
lib/bel_parser/language/version2_0/value_encodings/complex_abundance.rb,
lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb,
lib/bel_parser/language/version1_0/functions/transcriptional_activity.rb,
lib/bel_parser/language/version1_0/relationships/negative_correlation.rb,
lib/bel_parser/language/version1_0/relationships/positive_correlation.rb,
lib/bel_parser/language/version1_0/return_types/ribosylation_activity.rb,
lib/bel_parser/language/version1_0/value_encodings/biological_process.rb,
lib/bel_parser/language/version2_0/relationships/negative_correlation.rb,
lib/bel_parser/language/version2_0/relationships/positive_correlation.rb,
lib/bel_parser/language/version2_0/value_encodings/biological_process.rb,
lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb,
lib/bel_parser/language/version1_0/value_encodings/micro_rna_abundance.rb,
lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb,
lib/bel_parser/language/version2_0/value_encodings/micro_rna_abundance.rb,
lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb,
lib/bel_parser/language/version1_0/return_types/transcriptional_activity.rb,
lib/bel_parser/language/version1_0/upgrades/translocation_transformation.rb,
lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb,
lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb,
lib/bel_parser/language/version1_0/upgrades/protein_modification_transformation.rb

Overview

Language defines the concepts needed to define, represent, and validate a BEL specification. This includes:

  • BEL specifications

    • Functions

    • ReturnTypes

    • Signatures

    • Relationships

    • Encodings

    • Syntax validations

    • Semantic validations

  • Generic Syntax validations

  • Generic signature validation

Defined Under Namespace

Modules: AminoAcid, CovalentProteinModification, Function, Relationship, Semantics, Signature, Specification, Syntax, TermTransformation, Version1_0, Version2_0 Classes: ApplyDefaultNamespace, ApplyNamespaceEncoding, BaseSpecification, ExpressionValidator

Constant Summary collapse

DEFAULT_VERSION =
'1.0'

Class Method Summary collapse

Class Method Details

.default_specificationObject



63
64
65
# File 'lib/bel_parser/language.rb', line 63

def self.default_specification
  specification(DEFAULT_VERSION)
end

.default_versionObject



59
60
61
# File 'lib/bel_parser/language.rb', line 59

def self.default_version
  DEFAULT_VERSION
end

.defines_version?(version) ⇒ Boolean

Indicates if version is a defined BEL specification.

Parameters:

  • version (#to_s)

    the BEL version string (e.g. “2.0”)

Returns:

  • (Boolean)

    true if version is defined; false if not



35
36
37
38
39
40
# File 'lib/bel_parser/language.rb', line 35

def self.defines_version?(version)
  specification(version)
  true
rescue ArgumentError, LoadError
  false
end

.latest_supported_specificationSpecification

Returns the latest supported specification according to the MAJOR.MINOR pattern.

Returns:



79
80
81
82
# File 'lib/bel_parser/language.rb', line 79

def self.latest_supported_specification
  latest_version = versions.max_by { |version| version.to_f }
  specification(latest_version)
end

.latest_supported_versionString

Returns the latest supported version string according to the MAJOR.MINOR pattern.

Returns:

  • (String)

    latest supported version



71
72
73
# File 'lib/bel_parser/language.rb', line 71

def self.latest_supported_version
  versions.max_by { |version| version.to_f }
end

.specification(version) ⇒ Specification

Returns the Specification for a BEL specification version.

Parameters:

  • version (#to_s)

    the BEL version string (e.g. “2.0”)

Returns:

Raises:

  • (ArgumentError)

    if the version string is malformed or is not supported

See Also:

  • {{.defines?}


98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/bel_parser/language.rb', line 98

def self.specification(version)
  version_string         =  version.to_s
  unless version_string  =~ /^[0-9]+\.[0-9]+/
    raise ArgumentError, 'Version format incorrect; expecting MAJOR.MINOR'
  end

  LOCK.synchronize do
    version_sym           = version_string.to_sym
    @specs              ||= {}
    @specs[version_sym] ||= create_specification(version_string)
    @specs[version_sym]
  end
end

.specificationsArray<Specification>

Returns all language specifications.

Returns:



87
88
89
# File 'lib/bel_parser/language.rb', line 87

def self.specifications
  versions.map { |version| specification(version) }
end

.versionsArray<String>

Returns all version strings that are defined and supported by this project.

Returns:

  • (Array<String>)

    BEL language versions



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bel_parser/language.rb', line 46

def self.versions
  Dir[
    File.join(
      File.expand_path('..', __FILE__),
      'language',
      'version*.rb'
    )
  ].map do |path|
    file_name = File.basename(path)
    file_name.scan(/[0-9]+_[0-9]+/).first.sub('_', '.')
  end.sort
end