***()
**** load ../../Models/STM6Test/xall
load ../../Models/TinyKBMaude/all
load ../lib-util
load ../lib-meta   
load ../lib-imaude 
mod RFE is
  inc REWRITE .
  inc FILEMANAGER .
  inc G2D .
  inc SEQUENCER .
  inc LISTENER .
endm
load ../PLACORE/load-pla-core       

load maude2json-aux
***(
load basicops2json
red basicOps2json('LOCATIONOPS,"") .
red basicOps2json('MODIFICATIONOPS,"") .
red basicOps2json('PROTEINOPS,"") .

)

***(

getODbySN('LOCATIONOPS,'LocName,'CLo)
getODbySN('CHEMICALOPS,'Chemical,'2DOG)
getODbySN('MODIFICATIONOPS,'ACT,'act)
getODbySN('MODIFICATIONOPS,'FRAG,'cleaved)
getODbySN('MODIFICATIONOPS,'AAMOD,'acetyl)

getMDbySN('LOCATIONOPS,'LocName,'CLo)
getMDbySN('CHEMICALOPS,'Chemical,'2DOG)
getMDbySN('MODIFICATIONOPS,'ACT,'act)
getMDbySN('MODIFICATIONOPS,'FRAG,'cleaved)
getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl)

getMDbySN('PROTEINOPS,'BProtein,'Abca1)
"spnumber"
getMDbySN('PROTEINOPS,'Composite,'Pi3k)
"subunits"


red alist2json(getMDbySN('LOCATIONOPS,'LocName,'CLo),nil,"") .
red alist2json(getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl),nil,"") .
red alist2json(getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl),"abbrev","") .
red alist2json(getMDbySN('PROTEINOPS,'BProtein,'Abca1),"spnumber","") .
red alist2json(getMDbySN('PROTEINOPS,'BProtein,'Abca1),nil,"") .

)

***(
load locs2json
select LOCS2JSON .

red loc2json(getODbySN('LOCATIONOPS,'LocName,'CLo)) .
red locs2json('LOCATIONOPS) .
)

***(
load mods2json
select MODS2JSON .

red alookupd(getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl),"abbrev","default") .
red alookupd(getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl),"foo","default") .

red alist2cvs(getMDbySN('MODIFICATIONOPS,'AAMOD,'acetyl),"") .

red mod2json(getODbySN('MODIFICATIONOPS,'FRAG,'cleaved)) .
red mod2json(getODbySN('MODIFICATIONOPS,'AAMOD,'Yphos)) .
red mod2json(getODbySN('MODIFICATIONOPS,'SMBIND,'GDP)) .

red mods2json('MODIFICATIONOPS) .
)

***(
load entities2json

red prots2json(upOpDecls('PROTEINOPS,false),"","","","") .
red chems2json(upOpDecls('CHEMICALOPS,false),"") . 
red genes2json(upOpDecls('GENEOPS,false),"") .


mod TE is inc ENTITIES2JSON . inc STRING-OUTPUT-HACK . endm 

select ENTITIES2JKB .
red prots2jkb(upOpDecls('PROTEINOPS,false),"","","","") .

mod TE is inc ENTITIES2JKB . inc STRING-OUTPUT-HACK . endm 

red entities2jkb('RKB, 'PROTEINOPS, 'CHEMICALOPS, 'GENEOPS) .
red str2toks(entities2jkb('RKB, 'PROTEINOPS, 'CHEMICALOPS, 'GENEOPS)) .

red prots2jkb(upOpDecls('PROTEINOPS,false),"","","","") :: String .

red length(prots2jkb(upOpDecls('PROTEINOPS,false),"","","","")) .
red str2toks(prots2jkb(upOpDecls('PROTEINOPS,false),"","","","")) :: QidList .


red str2toks(chem2jkb(upOpDecls('CHEMICALOPS,false),"")) :: QidList . 
red str2toks(genes2jkb(upOpDecls('GENEOPS,false),"")) :: QidList .
)

***(
load occs2json
load rules2json

mod MAUDE2JSON is
  inc LOCS2JSON .
  inc MODS2JSON .
  inc ENTITIES2JSON .
  inc OCCS2JSON .
  inc RULES2JSON .
endm

load pla-json
)
