class BELParser::Language::Version1_0::Upgrades::ProteinModificationTransformation

Public Instance Methods

on_term(term_node) click to toggle source
# File lib/bel_parser/language/version1_0/upgrades/protein_modification_transformation.rb, line 14
def on_term(term_node)
  if ['pmod', 'proteinmodification'].include?(term_node.function.identifier.string_literal)
    # straightforward replacement of first argument to pmod with pmodtype value
    term_node.updated([term_node.function, update_pmod(term_node.arguments[0]), term_node.arguments[1], term_node.arguments[2] ].flatten)
  else
    term_node.updated([process(term_node.function), term_node.arguments.map! {|arg| process(arg)}].flatten())
  end
end
update_pmod(argument_node) click to toggle source
# File lib/bel_parser/language/version1_0/upgrades/protein_modification_transformation.rb, line 23
def update_pmod(argument_node)
  param_value = argument_node.child.value.children[0].string_literal
  argument(
    parameter(
      prefix(
        identifier('default')),
      value(
        identifier(PMODTYPES[param_value]))))
end