Module: BELParser::Language::TermTransformation

Constant Summary collapse

ACTIVITIES =
{
  'cat' => 'cat',
  'catalyticActivity' => 'cat',
  'chap' => 'chap',
  'chaperoneActivity' => 'chap',
  'gtp' => 'gtp',
  'gtpBoundActivity' => 'gtp',
  'kin' => 'kin',
  'kinaseActivity' => 'kin',
  'act' => 'act',
  'molecularActivity' => 'act',
  'pep' => 'pep',
  'peptidaseActivity' => 'pep',
  'phos' => 'phos',
  'phosphataseActivity' => 'phos',
  'ribo' => 'ribo',
  'ribosylationActivity' => 'ribo',
  'tscript' => 'tscript',
  'transcriptionalActivity' => 'tscript',
  'tport' => 'tport',
  'transportActivity' => 'tport'
}
PMODTYPES =
{
  'P' => 'Ph',
  'A' => 'Ac',
  'F' => 'Farn',
  'G' => 'Glyco',
  'H' => 'Hy',
  'M' => 'Me',
  'R' => 'ADPRib',
  'S' => 'Sumo',
  'U' => 'Ub'
}

Instance Method Summary collapse

Methods included from Parsers::AST::Sexp

#annotation_definition, #argument, #blank_line, build, #comment, #comment_line, #document_property, #domain, #function, #identifier, #keyword, #list, #list_item, #multi_identifier, #name, #namespace_definition, #nested_statement, #object, #observed_term, #parameter, #pattern, #prefix, #relationship, #set, #simple_statement, #statement, #string, #subject, #term, #unset, #uri, #url, #value

Methods included from AST::Processor::Mixin

#handler_missing, #process, #process_all

Instance Method Details

#collapse(node) ⇒ Object



83
84
85
# File 'lib/bel_parser/language/term_transformation.rb', line 83

def collapse(node)
  node.to_sexp(indent=0).gsub("\n", '')
end

#on_argument(argument_node) ⇒ Object



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

def on_argument(argument_node)
  argument_node.updated([process(argument_node.child)])
end

#on_function(function_node) ⇒ Object



74
75
76
# File 'lib/bel_parser/language/term_transformation.rb', line 74

def on_function(function_node)
  function_node.updated([process(function_node.identifier)])
end

#on_nested_statement(nested_statement_node) ⇒ Object



49
50
51
# File 'lib/bel_parser/language/term_transformation.rb', line 49

def on_nested_statement(nested_statement_node)
  nested_statement_node.updated([process(nested_statement_node.statement)])
end

#on_object(object_node) ⇒ Object



65
66
67
68
# File 'lib/bel_parser/language/term_transformation.rb', line 65

def on_object(object_node)
  return if object_node.nil?
  object_node.updated([process(object_node.child)])
end

#on_observed_term(observed_term_node) ⇒ Object



45
46
47
# File 'lib/bel_parser/language/term_transformation.rb', line 45

def on_observed_term(observed_term_node)
  observed_term_node.updated([process(observed_term_node.statement)])
end

#on_simple_statement(simple_statement_node) ⇒ Object



53
54
55
# File 'lib/bel_parser/language/term_transformation.rb', line 53

def on_simple_statement(simple_statement_node)
  simple_statement_node.updated([process(simple_statement_node.statement)])
end

#on_statement(statement_node) ⇒ Object



57
58
59
# File 'lib/bel_parser/language/term_transformation.rb', line 57

def on_statement(statement_node)
  statement_node.updated([process(statement_node.subject), statement_node.relationship, process(statement_node.object), statement_node.comment])
end

#on_subject(subject_node) ⇒ Object



61
62
63
# File 'lib/bel_parser/language/term_transformation.rb', line 61

def on_subject(subject_node)
  subject_node.updated([process(subject_node.term)])
end

#on_term(term_node) ⇒ Object

Called when visiting nodes of type term.



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

def on_term(term_node)
  term_node.updated([process(term_node.function), term_node.arguments.map! {|arg| process(arg)}].flatten())
end