Class: BELParser::Language::Version1_0::Upgrades::ProteinModificationTransformation
- Inherits:
-
Object
- Object
- BELParser::Language::Version1_0::Upgrades::ProteinModificationTransformation
- Defined in:
- lib/bel_parser/language/version1_0/upgrades/protein_modification_transformation.rb
Constant Summary
Constants included from TermTransformation
TermTransformation::ACTIVITIES, TermTransformation::PMODTYPES
Instance Method Summary collapse
Methods included from TermTransformation
#collapse, #on_argument, #on_function, #on_nested_statement, #on_object, #on_observed_term, #on_simple_statement, #on_statement, #on_subject
Methods included from Parsers::AST::Sexp
#annotation_definition, #argument, #blank_line, #comment, #comment_line, #document_property, #domain, #function, #identifier, #keyword, #list, #list_item, #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
#on_term(term_node) ⇒ Object
14 15 16 17 18 19 20 21 |
# 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) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# 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 |