Sha256: 959499cb2943c3386833018109fe37ae077786a0415587798a7fc01f0f09d40c
Contents?: true
Size: 1.27 KB
Versions: 37
Compression:
Stored size: 1.27 KB
Contents
require 'bel_parser/vendor/ast' require 'bel_parser/parsers/ast/node' require 'bel_parser/language/term_transformation' module BELParser module Language module Version1_0 module Upgrades class ProteinModificationTransformation include AST::Processor::Mixin include BELParser::Parsers::AST::Sexp include BELParser::Language::TermTransformation 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 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 end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems