Commit a475596d authored by Denis Shirshov's avatar Denis Shirshov

8

parent 288dbe64
comment
line
semicolon
constant
numeric
keyword
cursor
entity
name
function ; (define (FOO ...))
keyword
control ; (cond ...)
specialword
markup
other
function ; (FOO ...)
meta
declaration
variable ; (define a ...)
string
quoted
double
unquoted
herestring
support
function
module ; (require ...)
definition ; (define ...)
general ; (cons (car ...))
This diff is collapsed.
{
"name": "language-sbgn-lisp",
"version": "0.0.1",
"description": "PDTree graph description syntax support for Atom",
"repository": "https://github.com/prozion/language-tabtree",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {}
}
".source.sbgn-lisp":
editor:
commentStart: ";"
whitespace: # we use trailing tab to discern superclass from a class
ensureSingleTrailingNewline: false
removeTrailingWhitespace: false
# Tabtree graph description syntax support for Atom
Tabtree graph description syntax support for Atom.
name: "Tabtree"
scopeName: "source.tabtree"
comment: '''
'''
fileTypes: [
"tree"
"kg"
"mtree" # tree with multilines
"mkg"
]
'firstLineMatch': '^#!\\s*/.*\\bracket'
foldingStartMarker: '''
(?x)^ [ \t]* \(
(?<par>
( [^()\n]++ | \( \g<par> \)? )*+
)
$
'''
foldingStopMarker: "^\\s*$"
patterns: [
{
include: "#comment"
}
{
include: "#variant"
}
{
include: "#hyperlink"
}
{
include: "#date"
}
{
include: "#time"
}
{
include: "#place"
}
{
include: "#money"
}
{
include: "#percentage"
}
{
include: "#specialword"
}
{
include: "#parameters"
}
{
include: "#string"
}
{
include: "#superclass"
}
{
include: "#object"
}
{
include: "#category"
}
{
include: "#constants"
}
{
include: "#code"
}
]
repository:
variant:
patterns: [
{
name: "markup.underline boolean.language.constant"
match: "^[\\t]*?(->[A-Za-zА-Яа-я0-9_\\-\\(\\)/]+)"
}
]
parameters:
patterns: [
{
name: "keyword.control"
match: "(?<=\\s)(\\-?[^\"\t ]+?:)"
}
]
comment:
patterns: [
{
name: "comment.line.semicolon.racket"
captures:
"1":
name: "punctuation.definition.comment.racket"
match: "(;).*$\\n?"
}
]
constants:
patterns: [
{
name: "constant.numeric.racket"
match: "(?<=:|,|-|(\\s|:)-)([<~>]?[\\-+]?[0-9\\.]+)(?=[\\s,-])"
# match: "(?<=[\\(\\s])((#e|#i)?-?[0-9]+(\\.[0-9]+)?|(#x)[0-9a-fA-F]+|(#o)[0-7]+|(#b)[01]+)(?=[\\s;()'\",\\[\\]])"
}
# pull ups
{
name: "constant.numeric.racket"
match: "(?<=:|,|(\\s|:)-)([<~>]?[\\-+]?[0-9ul\\.]+)(?=[\\s,])"
}
]
hyperlink:
patterns: [
{
name: "markup.underline.link"
# match: "(?<=\")http.*?(?=\")"
match: "(?<=blog:).*?(?=\\s)|\
(?<=dir:).*?(?=\\s)|\
(?<=dtd:).*?(?=\\s)|\
(?<=email:).*?(?=\\s)|\
(?<=facebook:).*?(?=\\s)|\
(?<=fb:).*?(?=\\s)|\
(?<=file:).*?(?=\\s)|\
(?<=github:).*?(?=\\s)|\
(?<=gmail:).*?(?=\\s)|\
(?<=gplus:).*?(?=\\s)|\
(?<=is-defined-by:).*?(?=\\s)|\
(?<=iri:).*?(?=\\s)|\
(?<=moikrug:).*?(?=\\s)|\
(?<=my-mail:).*?(?=\\s)|\
(?<=linkedin:).*?(?=\\s)|\
(?<=odnoklassniki:).*?(?=\\s)|\
(?<=ok:).*?(?=\\s)|\
(?<=owl:).*?(?=\\s)|\
(?<=rdf:).*?(?=\\s)|\
(?<=spec:).*?(?=\\s)|\
(?<=twitter:).*?(?=\\s)|\
(?<=uri:).*?(?=\\s)|\
(?<=url:).*?(?=\\s)|\
(?<=vk:).*?(?=\\s)|\
(?<=vkontakte:).*?(?=\\s)|\
(?<=wiki:).*?(?=\\s)|\
(?<=wikipedia:).*?(?=\\s)|\
(?<=xsd:).*?(?=\\s)|\
(?<=xmlns:).*?(?=\\s)
"
# match: "(?<=\")http//[A-Za-z0-9\-/.]+?(?=\")"
# match: "(?<=:)[A-Za-z0-9\-]+\\.[A-Za-z0-9/.\-]+\\.(ru|by|ua|no|se|de|com|net|org|us|uk|info|io)"
}
]
string:
patterns: [
{
name: "string.quoted.double.racket"
match: "(\"[^\"]*?\")"
}
]
superclass:
patterns: [
{
name: "support.function.module.racket"
match: "^[\\t]*?([A-Za-zА-Яа-я0-9_\\-\\(\\)/]*)\\t$"
}
]
date:
patterns: [
{
name: "support.function.general.racket"
match: "(?<=(:|,|-|=))~?(((BC|AD)-)?([0-9x]{2}\\.)?((([0x][1-9x])|([1x][012x]))\\.)?[0-9x]{4}\\??|((17|18|19|20)[0-9x]{2})\\??|(BC|AD)-[0-9x]{1,4})(?=(\\s|,|:|-))"
}
# date with seasons
{
name: "support.function.general.racket"
match: "(winter|spring|summer|autumn)\\.[0-9x]{1,4}(?=(\\s|,|-))"
}
# for date as a key:
{
name: "support.function.general.racket"
match: "(?<=\t)(((BC|AD)-)?\
([0-9x]{2}(\\+[1-9y]{1,2})?\\.)?\
((([0x][1-9x])|([1x][012x]))\\??\\.)?\
[0-9x]{4}|((17|18|19|20)[0-9x]{2})|(BC|AD)-\\d{1,4})\
(\\?|~|>)?(?=\\s)"
}
]
time:
patterns: [
{
name: "meta.declaration.variable"
# name: "support.function.general.racket"
match: "~?([0-9x]?[0-9x]:)?[0-6x]?[0-9x]:([0-5x][0-9x])?(w|h|mo|tu|we|th|fr|sa|su|-)*"
}
]
place:
patterns: [
{
name: "boolean.language.constant"
match: "(?<=city:).*?(?=\\s)|(?<=city-en:).*?(?=\\s)|\
(?<=town:).*?(?=\\s)|\
(?<=hq:).*?(?=\\s)|\
(?<=place:).*?(?=\\s)"
}
]
money:
patterns: [
{
name: "racket.constant.keyword"
match: "[~<>]?[0-9][0-9\\-,.]*?[0-9]([BMK]|[BMK]?(NOK|EUR|RUB|[$RE]))"
}
]
percentage:
patterns: [
{
name: "entity.name.function.racket"
match: "[~<>]?[0-9.\-]+%%?"
}
]
category:
patterns: [
{
name: "keyword.control.racket"
# match: "^[\\t]*?([a-zа-я][A-Za-zА-Яа-яё0-9_+\\-\\(\\)/]*?)(\\s+\\b|$)"
match: "^[\\t]*?([_a-zа-я.][A-Za-zА-Яа-яё0-9_\\-\\(\\)\\?/]{1,}?)(?=(\\s+\\b|$|\\s+\"|\\s+\-|\\s+;))"
# match: "^[\\t]*?([a-zа-я0-9][A-Za-zА-Яа-яё0-9_.\\-\\(\\)/]{1,}?)(?=(\\s+\\b|$|\\s+\"|\\s+\-|\\s+;|\\s+[><=]))" ; with 'foobar >w:75' remains category
}
# if starts with a digit
{
name: "keyword.control.racket"
match: "^[\\t]*?([0-9][a-zA-ZА-Яа-яё0-9_\\-\\(\\)\\?/]+?)(?=(\\s+\\b|$|\\s+\"|\\s+\-|\\s+;))"
}
# for keyword with dots (makes possible to differ category from a date)
{
name: "keyword.control.racket"
match: "^[\\t]*?([a-zа-я.][A-Za-zА-Яа-яё0-9_\\-\\(\\)/]{2,}[A-Za-zА-Яа-яё0-9_.\\-\\(\\)/]+?)(?=(\\s+\\b|$|\\s+\"|\\s+\-|\\s+;))"
}
# if starting with upper-case letter
{
name: "keyword.control.racket"
match: "^[\\t]*?([A-Za-zА-Яа-яё0-9_\\-\\(\\)\\?\\+/]+?)(?=(\\s$|\\t\\b|\\t;))"
}
]
object:
patterns: [
{
name: "source.tabtree"
match: "^[\\t]*?([A-ZА-Я][A-Za-zА-Яа-я0-9_\\-\\(\\)/]*?)( \\b|$)"
}
# if starts with a digit
{
name: "source.tabtree"
match: "^[\\t]*?([0-9][A-Za-zА-Яа-я0-9_\\-\\(\\)/]*?)( \\b|$)"
}
]
specialword:
patterns: [
{
name: "support.function.general.racket"
match: "<(exists|t|f|null|\\.\\.\\.|unique|others|none|empty|many|current|start|end|self|gen-id|yes|no|all|na|oos|source|sink|active|inactive|out-of-service|nothing|project|etc|opensource|\\.|\\?)>"
# oos = out of service
}
]
code:
patterns: [
{
name: "meta.declaration.variable"
# name: "markup.tabtree.code"
match: "`.*?`"
}
]
{
"name": "language-tabtree",
"version": "0.0.1",
"description": "Tabtree graph description syntax support for Atom",
"repository": "https://github.com/prozion/language-tabtree",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {}
}
".source.tabtree":
editor:
commentStart: ";"
whitespace: # we use trailing tab to discern superclass from a class
ensureSingleTrailingNewline: false
removeTrailingWhitespace: false
......@@ -138,7 +138,7 @@
(if (file-exists? img-path)
(let* ((image-geometry (get-image-geometry img-path))
(w0 ($ width image-geometry))
(w (* 0.8 w0)))
(w (*r 0.8 w0)))
(~a w))
(~a 0)))
......
......@@ -22,4 +22,4 @@
(write-file "../html/generated/result.sbgn" af-xml)
))
(test-xml "../examples/metabolismregulation.org_refined/F100-aspirin-V003B-SBGNv02.sbgn")
(test-xml "../examples/metabolismregulation.org_refined/F020-pyrimidine-SBGNv02.sbgn")
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="activity flow">
<glyph id="glyph_n2" class="biological activity">
<label text="ERK1/2" />
<bbox x="185.0" y="100.0" w="80.0" h="40.0" />
</glyph>
<glyph id="glyph_n1" class="biological activity">
<label text="arachidonate" />
<bbox x="326.40875" y="0.0" w="100.0" h="36.0" />
<glyph id="glyph_n1-uoi-34" class="unit of information">
<label text="CAD" />
<bbox x="335.0" y="180.0" w="80.0" h="40.0" />
</glyph>
<glyph id="glyph_n4" class="biological activity">
<label text="glutamine" />
<bbox x="175.0" y="320.0" w="100.0" h="30.0" />
<glyph id="glyph_n4-uoi-22" class="unit of information">
<label text="" />
<entity name="simple chemical" />
<bbox x="356.40875" y="-5.0" w="40" h="10" />
<bbox x="205.0" y="315.0" w="40" h="10" />
</glyph>
</glyph>
<glyph id="glyph_n10" class="biological activity">
<label text="15R-HETE" />
<bbox x="949.2388" y="109.771484" w="100.0" h="36.0" />
<glyph id="glyph_n10-uoi-35" class="unit of information">
<glyph id="glyph_n8" class="biological activity">
<label text="glutamate" />
<bbox x="409.1602" y="370.0" w="100.0" h="30.0" />
<glyph id="glyph_n8-uoi-23" class="unit of information">
<label text="" />
<entity name="simple chemical" />
<bbox x="979.2388" y="104.771484" w="40" h="10" />
<bbox x="439.1602" y="365.0" w="40" h="10" />
</glyph>
</glyph>
<glyph id="modulation-30" class="and">
<bbox x="712.0" y="59.0" w="25" h="25" />
<port id="modulation-30-in" x="707.0" y="71.5" />
<port id="modulation-30-out" x="742.0" y="71.5" />
<glyph id="glyph_n10" class="biological activity">
<label text="carbamoyl-P" />
<bbox x="504.0" y="320.0" w="100.0" h="30.0" />
<glyph id="glyph_n10-uoi-24" class="unit of information">
<label text="" />
<entity name="simple chemical" />
<bbox x="534.0" y="315.0" w="40" h="10" />
</glyph>
</glyph>
<glyph id="glyph_n2" class="biological activity">
<label text="COX-2-dimer" />
<bbox x="760.1766" y="48.771484" w="80.0" h="40.0" />
<glyph id="modulation-17" class="and">
<bbox x="390.0" y="301.0" w="25" h="25" />
<port id="modulation-17-in" x="385.0" y="313.5" />
<port id="modulation-17-out" x="420.0" y="313.5" />
</glyph>
<arc class="logic arc" id="logic-arc-31" source="glyph_n1" target="modulation-30-in">
<start x="376.40875" y="36.0" />
<end x="707.0" y="71.5" />
<arc class="positive influence" id="modulation-16" source="glyph_n2" target="glyph_n1">
<start x="225.0" y="140.0" />
<end x="375.0" y="180.0" />
</arc>
<arc class="logic arc" id="logic-arc-18" source="glyph_n1" target="modulation-17-in">
<start x="375.0" y="220.0" />
<end x="385.0" y="313.5" />
</arc>
<arc class="logic arc" id="logic-arc-19" source="glyph_n4" target="modulation-17-in">
<start x="275.0" y="335.0" />
<end x="385.0" y="313.5" />
</arc>
<arc class="logic arc" id="logic-arc-32" source="glyph_n2" target="modulation-30-in">
<start x="760.1766" y="68.771484" />
<end x="707.0" y="71.5" />
<arc class="positive influence" id="positive-influence-20" source="modulation-17-out" target="glyph_n8">
<start x="402.5" y="326.0" />
<end x="459.1602" y="370.0" />
</arc>
<arc class="positive influence" id="positive-influence-33" source="modulation-30-out" target="glyph_n10">
<start x="724.5" y="84.0" />
<end x="999.2388000000001" y="109.771484" />
<arc class="positive influence" id="positive-influence-21" source="modulation-17-out" target="glyph_n10">
<start x="415.0" y="313.5" />
<end x="504.0" y="335.0" />
</arc>
</map>
</sbgn>
\ No newline at end of file
<!DOCTYPE html>
<html lang="ru">
<html>
<head>
<title>PD2AF - a conversion tool for SBGN diagrams</title>
<meta charset="utf-8">
......@@ -11,7 +11,7 @@
<div class="page_container">
<header>
<div class="logo">
<img src="img/pd2af_logo.png" />
<img src="img/pd2af_logo.png" alt="pd2af logo" />
</div>
<nav>
<a href="index.html" class="current_page_nav">Start</a><a href="specification.html" >Specification</a><a href="translator.html" >Try it!</a>
......@@ -32,18 +32,18 @@
<h2>Implementation</h2>
<img src="img/application_components.png" class="illustration" />
<img src="img/application_components.png" class="illustration" alt="application components" />
<p>For convenient implementation of Converter function, we have developed some infrastructure around it. The resulted system is shown on the picture above. The modules of the system are:
<div class="p">For convenient implementation of Converter function, we have developed some infrastructure around it. The resulted system is shown on the picture above. The modules of the system are:
<ul>
<li><a href="https://gitlab.com/ddenniss/odysseus/blob/master/tabtree-format/html.rkt">Webpages Generator</a> - Processes html and css templates into correspondent html, css and svg files. Works like similar template engines (e.g. JSP, Django Template Language or SASS), but also allows insertions of Racket code snippets.</li><li><a href="https://gitlab.com/ddenniss/odysseus/tree/master/tabtree-format">Knowledge Tree Reader</a> - Handles files in .tree format, specially invented for convenient textual encoding of the key-value objects in hierarchy. This model often comes to be useful when we need to structurize some knowledge field or put some cognitive map into the text.</li><li><a href="https://github.com/prozion/odysseus-modules/tree/master/sbgn-lisp">SBGN-Lisp Language</a> - Special lisp-like syntax and related tools that allow to write SBGN in the form of sexp expressions. This brings an opportunity to codify SBGN otherwise graphical diagrams in the textual way. It is far more convenient to work with, comparing to SBGN-ML which is usually used to save diagram in computer-readable format (XML), but fails to be readable by human.</li><li><a href="https://github.com/prozion/odysseus-modules/tree/master/pd2af">PD2AF Converter</a> - Translates SBGN PD diagrams into SBGN AF. Also converts XML (SBGN ML) to sexp expression, and sexp expression back to XML.</li>
</ul>
</p>
</div>
<h2>Converter design</h2>
<img src="img/translator_design.png" class="illustration" />
<img src="img/translator_design.png" class="illustration" alt="translator design" />
<p>To convert PD SBGN diagram to the AF SBGN, data undergoes several stages of transformations. Red arrows show implemented transformations.
<div class="p">To convert PD SBGN diagram to the AF SBGN, data undergoes several stages of transformations. Red arrows show implemented transformations.
<ol>
<li>We build internal represenattion of the diagram, transforming XML to sexp expression.</li>
<li>Then, we clean and normalize sexp expression, make it ready for pattern matching</li>
......@@ -51,10 +51,10 @@
<li>After this the form is cleaned again, to provide more compact and sensible AF output</li>
<li>On the last stage we translate sexp expression back to XML, this time SBGN AF ML format. Further this XML file with AF diagram can be uploaded and viewed/edited in the SBGN editor, such as <a href="http://newteditor.org">Newt</a> or <a href="http://sbgn-ed.org">VANTED</a>.</li>
</ol>
</p>
</div>
<footer>
<div>Page generated <b>20.02.2019</b></div>
<div>Page generated <b>24.04.2019</b></div>
</footer>
<!-- Yandex.Metrika counter -->
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="activity flow">
<glyph id="A1" class="biological activity">
<label text="A-active1" />
<bbox x="160.0" y="230.0" w="80" h="40" />
</glyph>
<glyph id="A2" class="biological activity">
<label text="A-active2" />
<bbox x="360.0" y="230.0" w="80" h="40" />
</glyph>
<glyph id="C" class="biological activity">
<label text="C" />
<bbox x="260.0" y="130.0" w="80" h="40" />
</glyph>
<arc class="positive influence" id="modulation-26" source="C" target="A1">
<start x="300.0" y="170.0" />
<end x="200.0" y="230.0" />
</arc>
<arc class="positive influence" id="modulation-27" source="C" target="A2">
<start x="300.0" y="170.0" />
<end x="400.0" y="230.0" />
</arc>
</map>
</sbgn>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sbgn xmlns="http://sbgn.org/libsbgn/0.2">
<map language="process description">
<glyph id="A1" class="macromolecule">
<label text="A" />
<bbox x="160.0" y="230.0" w="80" h="40" />
<glyph id="A1-state-variable-24" class="state variable">
<state value="active1" variable="" />
<bbox x="230.0" y="222.5" w="15" h="15" />
</glyph>
</glyph>
<glyph id="A2" class="macromolecule">
<label text="A" />
<bbox x="360.0" y="230.0" w="80" h="40" />
<glyph id="A2-state-variable-25" class="state variable">
<state value="active2" variable="" />
<bbox x="430.0" y="222.5" w="15" h="15" />
</glyph>
</glyph>
<glyph id="C" class="macromolecule">
<label text="C" />
<bbox x="260.0" y="130.0" w="80" h="40" />
</glyph>
<glyph id="p" class="process">
<bbox x="288.0" y="238.0" w="24" h="24" />
<port id="p-in" x="283.0" y="250.0" />
<port id="p-out" x="317.0" y="250.0" />
</glyph>
<arc class="production" id="production-21" source="p-in" target="A1">
<start x="317.0" y="250.0" />
<end x="240.0" y="250.0" />
</arc>
<arc class="production" id="production-22" source="p-out" target="A2">
<start x="317.0" y="250.0" />
<end x="360.0" y="250.0" />
</arc>
<arc class="catalysis" id="modulation-23" source="C" target="p">
<start x="300.0" y="170.0" />
<end x="300.0" y="238.0" />
</arc>
</map>
</sbgn>
\ No newline at end of file
......@@ -9,15 +9,15 @@
<label text="A-active2" />
<bbox x="360.0" y="230.0" w="80" h="40" />
</glyph>
<glyph id="C" class="macromolecule">
<glyph id="C" class="biological activity">
<label text="C" />
<bbox x="260.0" y="130.0" w="80" h="40" />
</glyph>
<arc class="positive influence" id="modulation-666" source="C" target="A1">
<arc class="positive influence" id="modulation-694" source="C" target="A1">
<start x="300.0" y="170.0" />
<end x="200.0" y="230.0" />
</arc>
<arc class="positive influence" id="modulation-667" source="C" target="A2">
<arc class="positive influence" id="modulation-695" source="C" target="A2">
<start x="300.0" y="170.0" />
<end x="400.0" y="230.0" />
</arc>
......
......@@ -4,7 +4,7 @@
<glyph id="A1" class="macromolecule">
<label text="A" />
<bbox x="160.0" y="230.0" w="80" h="40" />
<glyph id="A1-state-variable-664" class="state variable">
<glyph id="A1-state-variable-692" class="state variable">
<state value="active1" variable="" />
<bbox x="230.0" y="222.5" w="15" h="15" />
</glyph>
......@@ -12,7 +12,7 @@
<glyph id="A2" class="macromolecule">
<label text="A" />